Hello. Sorry, if my question seems stupid to you, im fairly new to stata and cant seem to figure out the problem on my own.

I want to recode a list of variables at the same time by using the loop foreach. My problem is that the following syntax seems to be wrong:


foreach var of varlist v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 {
recode `var' (4=2)
}


I would appreciate it if someone would tell me what i'm doing wrong or what i'm missing in the syntax.

Thanks in advance