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]
Re: st: detecting a complete data set
From
Maarten buis <[email protected]>
To
[email protected]
Subject
Re: st: detecting a complete data set
Date
Tue, 16 Nov 2010 13:44:20 +0000 (GMT)
--- 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/