Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: RE: RE: Label variable


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: RE: Label variable
Date   Thu, 23 Feb 2006 12:27:23 -0000

My bias towards lower case slipped through. 
Evidently what you need is 

gen grade1 = "Excellent" if GRADE == "A"

i.e. the command is taken quite literally. 

Nick 
[email protected] 

Mosca, Ilaria
 
> Thanks for the hint. But although the command works, why do I get an
> empty column as a result? That is to say:
> Grade		grade1
> A
> B
> C

Nick Cox
 
> Value labels in Stata are associations between 
> numeric values and text labels. 
> 
> You can get what you want in Stata only by
> generating another string variable. 
> 
> gen grade1 = "Excellent" if GRADE == "a"
> replace grade = "Very good" if GRADE == "b" 
> 
> etc. 
 
Mosca, Ilaria
  
> > I would like to assign labels to a variable. This variable,
> > however, has
> > no numeric values but letters. So I have something like:
> > GRADE
> > A
> > A
> > B
> > B
> > C
> > D
> > I would like to label "A" as "excellent", "B" as "very good", etc.
> > So far I tried the following command, but unsuccesfully:
> > Label define grade a "excellent", add
> > 
> > Is the problem due to the fact that Stata does not 
> recognize letters?

*
*   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