On 6/20/07, bunny , lautloscrew.com <[email protected]> wrote:
HI everybody,
i have several non-response in my dataset that are coded -1 .
i�d like to drop any observation (row) where one or more columns
contains a -1.
In R there's na.omit to the job. is there a similiar syntax in stata ?
To echo Nick Cox's comment the other day with regards to similar
constructs between Stata and R (see
http://www.stata.com/statalist/archive/2007-06/msg00382.html)
"In general, there is no more reason to expect R syntax to work in
Stata than there is to expect Stata syntax to work in R."
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' == .)
}
Neil
--
"In mathematics you don't understand things. You just get used to
them." - Johann von Neumann
Email - [email protected] / [email protected]
Website - http://slack.ser.man.ac.uk/
Photos - http://www.flickr.com/photos/slackline/
*
* 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/