Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Is there a way to replace a variable with a missing value without knowing if it is numeric or string?
From
"Gupta, Ani" <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: Is there a way to replace a variable with a missing value without knowing if it is numeric or string?
Date
Fri, 26 Jul 2013 07:18:20 +0000
I have a series of variables, - say name, age, position, startdate - some of which are numeric and some of which are string. I want to replace their values with missing values if another variable, indicator is equal to 1.
In other words I want to be able to write something like this:
foreach var in name age position startdate {
replace `var' = _missing_ if indicator == 1
}
Is there a way I can do this in a single loop for numeric and string variables?
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/