I want to replicate this code up to stateid==32; from 1 to 32. How can I do this without typing it out 32 times. Do a loop?
gen s1_trend = time if stateid==1
recode s1_trend .=0
gen s2_trend = time if stateid==2
recode s2_trend .=0
gen s3_trend = time if stateid==3
recode s3_trend .=0
gen s1_trend = time if stateid==1
recode s1_trend .=0
gen s2_trend = time if stateid==2
recode s2_trend .=0
gen s3_trend = time if stateid==3
recode s3_trend .=0
Comment