Hi,
I have never done a loop in STATA (only in TSP). I have read on how to loop but can not seem to figure this out.
If I want to code the following:
gen r_va02 = clc_va02/ppp_food if nace_ind=="da15";
replace r_va02 = clc_va02/ppp_tobacco if nace_ind=="da16";
replace r_va02 = clc_va02/ppp_clothing if nace_ind=="db17" |
nace_ind=="db18" | nace_ind=="dc19";
replace r_va02 = clc_va02/ppp_gdp if nace_ind=="dd20" |
nace_ind=="de21" | nace_ind=="de22" |
nace_ind=="df23" | nace_ind=="dg24" |
nace_ind=="dh25" | nace_ind=="di26" |
nace_ind=="dj27" nace_ind=="dj28" |
nace_ind=="dm34" | nace_ind=="dm35" |
nace_ind=="dn36";
replace r_va02 = clc_va02/ppp_mach_eqp if nace_ind=="dk29" | nace_ind=="dl30" | nace_ind=="dl31" | nace_ind=="dl32" | nace_ind=="dl33";
*
* 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/