Dear Stata users,
I would like to execute the following command through a loop:
replace q33_1=.a if q29_1 ==.a
replace q33_2=.a if q29_2 ==.a
replace q33_3=.a if q29_3 ==.a
replace q33_4=.a if q29_4 ==.a
replace q33_5=.a if q29_5 ==.a
I already tried with :
forvalues v =1(1)5{
replace q33_`v'=.a if q29_`v'==.a
}
But it's not working. Thank you for your help.
Best,
Jules
0 Response to Replacing values using a loop
Post a Comment