I am doing the following and fervently believe that there are more
elegant, faster ways to do this. (I am working in Stata 8.2 but will be
updating to 9 any day now.) Occupational history codes jobnum1-jobnum16
each take one of 500 values from 003 to 909, and I am assigning a
Nam-Powers status value (1 to 100) to each occupation held.
forvalues i=1 to 16{
gen jobstatus`i'=.
}
forvalues i=1 to 16{
replace jobstatus`i'= 86 if jobnum`i'== 003
}
forvalues i=1 to 16{
replace jobstatus`i'= 77 if jobnum`i'== 004
}
...
forvalues i=1 to 16{
replace jobstatus`i'= 08 if jobnum`i'== 909
}
It's not a problem to me to do this in this kludgy fashion, but I'd like
to learn how Stata experts would do it. Please enlighten me. Thank you
very much.
Jennifer Marino, PhC
Epidemiology
University of Washington/Fred Hutchinson Cancer Research Center
*
* 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/