Hi David,
You actually provided the solution yourself. Just wrap it up into
repmiss.ado:
program repmiss
version 8
syntax varname [if] [in]
local typ: type `varlist'
if substr("`typ'", 1, 3) == "str" {
replace `varlist' = "" `if' `in'
}
else {
replace `varlist' = . `if' `in'
}
end
However, when using post you can't get around knowing the variable types, I
believe.
Regards,
Morten
----------------------------------------------------------------------------
Morten Andersen, MD, PhD Research Unit for General Practice
Senior Researcher University of Southern Denmark
Phone +45 6550 3791 J.B. Winsloews Vej 9
Fax +45 6311 1642 DK-5000 Odense C
E-mail [email protected] Denmark
----------------------------------------------------------------------------
Hi everyone,
Is there a concise way to set a variable to a missing value if you don't
know its type (string vs. numeric)? This would be the reverse of the mi()
function -- reverse in that you are setting rather than testing the value.
Suppose I have a local v that contains a variable name, and I want to
replace the variable to missing.
[...]
What I'd like is something like
replace `v' = universal_missing_symbol_that_works_regardless_of_data_type
[...]