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
DMARIANO in stata: Diebold_Mariano test: basic questiondmariano (written by Christopher Baum; ssc install dmariano) performs the Diebold_Mariano test for p…
Testing the difference between mediansHi, I have two groups. One group watches a median of 4 hours of TV per day. The other group watches…
Identifying differences in a variable within a datasetI have a dataset that has data that is pooled across different years. At the moment, I would to lik…
Significant difference between two metric variablesWe have made a pre-test and asked respondents to evaluate the direction and strength of 7 arguments …
Distribution of frequency of a unique variableHi everyone I am relatively new to STATA. I have the following problem I cannot solve: Given my dat…
Subscribe to:
Post Comments (Atom)
0 Response to Recoding variables using commando loops
Post a Comment