I have a survey where most variables have a different code for missing values, I need to unify the code for missing values.
According to my survey variables (>500 variables) the values can be 9, 97, 98, 99, 999, 9997, 9998, 9999, etc. I need to change them all to '.'
To use 'recode' is not efficient as I need to to go through the variables one by one and group them into categories that have the same code for missing.
Alternatively, they all have one thing in common: the label to the missing value is "Manquant" regardless of the underlying value (9, 99, 997, etc).
An efficient solution is to be able to recode all variables at once, as soon as the label is identified to be "Maquant".
I tried the following code:
Code:
foreach var in varlist E* { replace `var'=. if `var'== "Manquant" :`var'0valuelabel }
Any help?
Thx!
S.
0 Response to Replace missing values by system-missing '.' if label value is "Manquant"
Post a Comment