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
Dynamic binary panel models with endogeneityHi all, I have a question related to dynamic panel analysis. As we know, xtabond2 is suitable to u…
Help on ICC / dice scoreDear Stata community, I have some data for which I want to calculate intraclass correlation coeffic…
Dropping all Observations in a Longitudinal Data Set if Two Conditions are met.Hi Stata users, I am trying to drop entire records of individuals from this set if they had an oppo…
Aggregate data based on two variablesHello Stata Community, I am new to Stata and have a question regarding the aggregation of a dataset…
Sorting VariablesHi I need to create a certain variable by sorting other variables, but I am not sure how to sort t…
Subscribe to:
Post Comments (Atom)
0 Response to Recoding variables using commando loops
Post a Comment