Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[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   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: My stata won't -tab- with my value labels - why?
Date   Fri, 9 Sep 2011 23:29:06 +0100

Two points:

First,

label define 0 "male" 1 "female"

won't work. You probably meant to type something like

label define fem 0 "male" 1 "female"

Second, what you're not getting is that defining labels is just one of
two steps. You must explicitly link them to the variable you want by
something like

label val fem fem

Even if the value labels have the same name as a variable, that means nothing.

There isn't a one-to-one association between variables and value
labels. The same value labels could be used for different variables.

This is all exemplified in the help.


On Fri, Sep 9, 2011 at 10:56 PM, Brandon Olszewski
<[email protected]> 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?
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index