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