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]

st: Generating new variable with new values from the old one


From   "Shittu, Aminu" <ameen_vet@yahoo.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: Generating new variable with new values from the old one
Date   Wed, 5 Sep 2012 08:11:04 -0700 (PDT)

Dear Statalisters,

I am interested in generating a new "agecat" variable and then rename every value in the original "age_category" named "NA," "NONE" and "UNKNOWN" to mean the same, I will call all of the as "NONE." However, I am interested in keeping those values such as "ADULT," and "YOUNG" to mean the same as in the original "age_category" variable. I used the following initially but the response is always "adult not found," is there a way I can do it in Stata? Here are my command lines:

gen agacat=.
replace agecat=adult if age_category==adult

Please note all the entries in var "age_category" are in CAPS.

Thanks

Aminu

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