Based on info from a previous thread, I created the following code to replace all -99s with "". This code works, but I wanted to know if there's a more elegant way to do this, given that this is ten lines of code.
Code:
*puts the variables into r(varlist)
ds, has(type byte int long)
local varlist "`r(varlist)'"
foreach v of local varlist {
recode `v' (-99 = .n)
}
ds, has(type string)
local varlist "`r(varlist)'"
foreach v of local varlist {
replace `v'="" if `v'=="-99"
}

Comment