I have several variables - some numeric and some string - in my dataset. The string variables are so because the missing values are denoted as "NA" among non missing numeric observations. I want to replace the "NA" by "." and then destring the variables. One way to destring the data would be to use the following:
foreach v of varlist v1 v5 v7 v9 .... {
replace `v' = subinstr(`v', "NA", ".", .)
}
destring, replace
But since there are too many variables its cumbersome to type all of them using foreach. Is there an efficient way to do this?
foreach v of varlist v1 v5 v7 v9 .... {
replace `v' = subinstr(`v', "NA", ".", .)
}
destring, replace
But since there are too many variables its cumbersome to type all of them using foreach. Is there an efficient way to do this?
Comment