Hello all, I am new to STATA and trying to loop replace function. Is there a way to improve my code?
replace d_20180706 = 25 if d_20180706 == 1
replace d_20191001 = 30 if d_20191001 == 1
replace d_20180823 = 25 if d_20180823 == 1
replace d_20191002 = 30 if d_20191002 == 1
replace d_20180924 = 10 if d_20180924 == 1
replace d_20190601 = 25 if d_20190601 == 1
replace d_20190901 = 15 if d_20190901 == 1
Thanks a lot for the help.
Related Posts with Looping replace function
create a loop to convert string variables in numeric variablesHello, I am Salvatore, happy to join the Stata Forum community. I am a new user who recently started…
Matching without replacement from a file of pairs for case-control and other applicationsShort version: I’m seeking a solution to how to do 1:m matching of cases and controls without replac…
Shortcut for generating new variables based on many existingI have groups of variables contactoutcome_con_<y>_<x> and contactmethod_con_<y>_&l…
how to replace/recode variables that are a multiple of some numberHi I have a variable "level" that ranges from 1 to 125 I would like to recode it into a variable "pi…
Possible to put interaction terms of X and indictors of Y quintile in a regression?Dear Statalist users, I am wondering if I would estimate a regression like this: Y = X + X * Y_Q2 …
Subscribe to:
Post Comments (Atom)
0 Response to Looping replace function
Post a Comment