Hi Stata Forum,
I'm trying to recode a list of variables using foreach. The variables have some categories i want to code as missing, some of them, however, have a category the others don't have. What I tried to do was the following:
foreach X of var_* {
recode X 98 99 -1 =.
}
I'm not sure if the problem is that not all of var_* have the -1 category, or if I'm using foreach wrong.
Thank you in advance
Kasper Loven
Related Posts with Recoding variables using commando loops
Foreach recodeHello. Sorry, if my question seems stupid to you, im fairly new to stata and cant seem to figure out…
Error "pweights must be positive"Hi Statalists, I keeps getting an error message, ""pweights must be positive", when using the "mixe…
Panel Data with Count DV - CEM & Diff-in-Diff & NBREGHello! In my dataset, I'm looking to model the effect of a particular treatment on the number of pa…
graph estimated coefficients after oaxaca_rif commandDear all, I use oaxaca_rif user written command by Rios-Avila (Rios-Avila, F. 2020. Recentered infl…
multilevel modelling - syntaxHello, How are the two following lines of code different in the way they treat the cluster variable…
Subscribe to:
Post Comments (Atom)
0 Response to Recoding variables using commando loops
Post a Comment