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 on April 23, and its replacement, 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   José Maria Pacheco de Souza <>
Subject   Re: st: My stata won't -tab- with my value labels - why?
Date   Fri, 09 Sep 2011 20:55:41 -0300

Em 09/09/2011 18:56, Brandon Olszewski escreveu:
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?

Dear Brandon:
I think that is missing the name of the label and, after label define and before tab fem, the command to "glue" the label in your variable:

label define labelname 0 "male" 1 "female" . "missing"
label values female labelname
tab fem, sort mis

josé maria

Jose Maria Pacheco de Souza
Professor Titular (aposentado), Colaborador Senior
Departamento de Epidemiologia/Faculdade de Saude Publica, USP
Av. Dr. Arnaldo, 715
01246-904  -  S. Paulo/SP - Brasil
fones (11)3061-7747; (11)3768-8612
*   For searches and help try:

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