Hi, I am trying to recode the categorical variables in the dataset in the following ways, but getting errors for both:
Please suggest how can this be corrected.
Thank you.
Code:
foreach var of varlist * {
replace `var' = . if `var' == "Unsure" | `var' == "Prefer not to say"
}
type mismatch
r(109);
Code:
. foreach var of local vars {
2. recode `var' (Unsure = .)
3. recode `var' (Prefer not to say = .)
4. }
unknown el Unsure in rule
r(198);
Thank you.

Comment