I am new to learning the loop command and could not find help from google. I am trying to use the foreach loop command to change all LEGITIMATE SKIP and RESPONDENT SKIP to missing. The label numbers for them are different in different variables that’s why I am struggling with how I can use the value label “LEGITIMATE SKIP” and “RESPONDENT SKIP” (which are responses in all variables) in the loop command.
I tried:
foreach v of varlist gender age ethnicity income employment {
replace `v’ = . if `v’ == “LEGITIMATE SKIP”
}
This is giving me an error. Is there a way to do this?
Thanks!
I tried:
foreach v of varlist gender age ethnicity income employment {
replace `v’ = . if `v’ == “LEGITIMATE SKIP”
}
This is giving me an error. Is there a way to do this?
Thanks!
Comment