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
Related Posts with Replacing values using a loop
Probability Proportional to Size (PPS)Hi , I want to get 1500 samples from the variable maymay_list using PPS method on township level. Ho…
Convergence issues with GLLAMMHi all, I am trying to run a multilevel model on Stata 15 using gllamm. Our data comes from multipl…
Centering Age Variable for VIFHello everyone, I am relatively new with stata and I am currently conducting a fixed-effects regress…
appending datasets receive r106 error - need to convert string vars to byte varsHi, I am new to STATA and am trying to combine multiple datasets which have multiple obs for multipl…
Collapsing dataset with only the latest value for each variableHi Stata users, I am having a dataset of some indicators for countries over years. Below is an exam…
Subscribe to:
Post Comments (Atom)
0 Response to Replacing values using a loop
Post a Comment