Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Label values problem


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Label values problem
Date   Thu, 19 Feb 2004 21:21:59 -0000

With this definition, your command 
should presumably be 

label val agecat agecat 

(_not_ agecatv). So on your evidence
this is just a typo. 

-label values- and -replace- do quite 
different things, so I don't know in 
what sense you regard them as comparable. 

Most of the point of value labels is to 
associate text with integer-valued categorical
variables. An alternative would be to map such variables  
on to strings, but then the natural sort order 
would be alphanumeric, not numeric, and in 
addition many Stata commands are not available
for string variables. 

So if I grade books 

1 excellent 
2 good
3 fair 
4 poor
5 abysmal 

that ordering is lost by a mapping to strings. 

There is more discussion of numbers and strings
in Stata Journal 2(3):314--329 (2002). 

Nick 
[email protected] 

Paul O'Brien
 
> Can someone explain my error please. agecat is not accepting 
> the value 
> labels.
> 
> ......
> . gen agecat=recode(age, 16, 20,25,30,35,40,45,50,55,60,65,70,75,80)
> (100 missing values generated)
> 
> . label define agecat 16 "<16" 20 "16-19" 25 "20-24" 30 "25-29" 35 
> "30-34" 40 "35-39" 45 "40-44" 50 "45-
>  > 49" 55 "50-54" 60 "55-59" 65 "60-64" 70 "65-69" 75 "70-74" 
> 80 "75-79"
> 
> . label values  agecat agecatv
> 
> . list in 1
> 
> Observation 1
> 
>           age     20.08487     ...   agecat           25
> ......
> 
> Also, any reason for using value labels over replace?

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index