Dear all,

I have a quick question about the Stata syntax. I want to refer to a list of variables that are numbered consecutively (e.g., class0, class1, class2, ..., class99). Since the number of variables can change, I want to refer flexibly to the minimum and maximum values in the list. I thought of something like the following (only the first line is relevant) and hoped that someone could point me to the correct syntax, which I could not find:


Code:
foreach var of varlist class`min'-class`max' {
    replace `var' = 0 if `var' == .
    }
With the code above, I would get "class ambiguous abbreviation" as an error message.

Best,

Marvin