Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: My stata won't -tab- with my value labels - why?


From   Steve Nakoneshny <scnakone@ucalgary.ca>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: My stata won't -tab- with my value labels - why?
Date   Fri, 9 Sep 2011 16:30:19 -0600

Hi Brandon,

I've run into this problem in the past. You're missing two key steps:

1) when you define your label, you have to apply a name to it. When you enter -label define 0 "male" 1 "female"- you should add something descriptive to the label such as -label define femlab 0 "male" 1 "female"-

2) second issue is that once you define a label, you need to apply it to your variable (or a series of variables depending on your label) with -label values fem femlab-


After that, you can get the output you want with -tab fem, m-

Thanks,
Steve
~~~~~~~~~~~~~~~~~~~~
Steve Nakoneshny
Research Assistant
Ohlson Research Initiative
University of Calgary - Faculty of Medicine
HRIC 2A02
3280 Hospital Dr. NW
Calgary AB T2N 4Z6
Tel: (403) 220-4347
Fax: (403) 270-3145
www.ohlsonresearch.ca




On 2011-09-09, at 3:56 PM, Brandon Olszewski wrote:

> Hi all:
> I'm frustrated because I can't get -tab- output with the value labels,
> but instead, only their numeric codes. Here's a simplified example...
> Let's say I've got the var <female> coded as 0 and 1.
> .
> label define 0 "male" 1 "female"
> tab fem, sort mis
> 
> ...produces -tab- output that doesn't include the labels "male" and
> "female", but instead, 0 & 1. I want a labeled table of frequencies
> (sorted, and showing missing observations, in this case) so that I
> don't have to manually insert the labels.
> Clearly with this example it doesn't matter too much. But with the
> dataset I've got, it is consequential.
> This should be simple. Can anyone help me understand what I'm doing
> wrong, and how to fix it?
> Thanks,
> Brandon
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index