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
Related Posts with Foreach recode
Summing observations that fall below a scoreI am hitting a wall trying to create a variable that is a conditional sum where it looks at the scor…
Labeling interaction terms in coefplotHi, I am trying to create a coefficient plot using just an interaction term that interacts a dummy …
Panel data error due to several companies inside countryI am currently writing my master thesis and need to check how percentages of females on the manageme…
Messy string data: how to do crosstabulations and descriptivesDear STATA community, Please help! I have messy data containing over thirty variations of different…
generate mean value of a locality excluding the focal firm and firms in the same industry as the focal firmDear Statalist, I am trying to generate the mean value of a locality, excluding the focal firm and …
Subscribe to:
Post Comments (Atom)
0 Response to Foreach recode
Post a Comment