Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Donald Spady <dspady@ualberta.ca> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: detecting a complete data set |
Date | Tue, 16 Nov 2010 06:54:21 -0700 |
Maarten Seems to work. The result makes sense. I assume that if complete takes the value 0 that there are missing data, and if it takes the value 1 then the data are complete. I am unsure about the grammer of "gen byte complete = totmis == 0" Does this mean "generate complete = 1 IF totmis == 0" Many thanks. Don On 2010-11-16, at 6:44 AM, Maarten buis wrote: > --- Donald Spady wrote: >> I want to detect the ID that has no data missing for ALL Levels >> within that ID. In this case ID 2 fits the bill, ID 1 has data >> missing in levels 2 and 3 > > *---------- begin example ------------- > drop _all > input id level a b c d > 1 1 1 1 1 1 > 1 2 1 0 . 0 > 1 3 . 1 0 . > 1 4 1 0 1 1 > 2 1 1 0 1 1 > 2 2 0 0 0 1 > 2 3 0 1 1 1 > 2 4 1 1 1 1 > end > gen byte mis = missing(a, b, c, d) > bys id : egen int totmis = total(mis) > gen byte complete = totmis == 0 > drop mis totmis > list , sepby(id) > *------------ end example ------------ > (For more on examples I sent to the Statalist see: > http://www.maartenbuis.nl/example_faq ) > > Hope this helps, > Maarten > > -------------------------- > Maarten L. Buis > Institut fuer Soziologie > Universitaet Tuebingen > Wilhelmstrasse 36 > 72074 Tuebingen > Germany > > http://www.maartenbuis.nl > -------------------------- > > > > > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ > Don Spady Nature bats last. * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/