| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: na.omit synonym
Neil said
Looping over the observations will do it...
* Convert -1 to Stata's internal missing for your variables
mvdecode a b c d, mv(-1)
* Loop over variables and drop if they are missing
foreach x in varlist a b c d{
drop if(`x' == .)
}
For one thing I would not describe this as 'looping over the
observations'. It is not an explicit loop (which is generally to be
avoided).
You might also consider something like
egen check=anymatch(price-foreign),val(-1)
drop if check
Note that a -varlist- may contain a hyphenated list of variables, so
need not include each varname. The list is in the order of the
variables in the dataset (or in the Variables window), which can be
modified with -order-.
Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/