Hello,
I am running a loop to remove all value labels and leave them as string variables.
However, this is causing problems as some variables that are being "cleaned" are numerical variables, where -1 is the only value encoded as missing. Is there a better way to perform this cleaning? In other words, for some variables, they are numeric values (like weight) and this operation causes them to be missing observations.
I am running a loop to remove all value labels and leave them as string variables.
Code:
ds, has(vallabel) foreach v of varlist `r(varlist)'{ decode `v', gen(temp) replace temp = trim(itrim(lower(temp))) order temp, after(`v') rename `v' `v'_old rename temp `v' drop `v'_old } label drop _all
Comment