Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: RE: Filtering observations.. Urgent HELP


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: Filtering observations.. Urgent HELP
Date   Mon, 29 Aug 2005 22:02:59 +0100

bysort shcode : egen npresent = sum(!mi(dependencia) + !mi(reservas)) 

would be better as

bysort shcode : egen npresent = sum(!mi(dependencia) & !mi(reservas)) 

Nick 
n.j.cox@durham.ac.uk 

Nick Cox
 
> To get a count of missings in your two variables
> you can go 
> 
> egen nmiss = rowmiss(dependencia reservas) 
> 
> or 
> 
> gen nmiss = mi(dependencia) + mi(reservas) 
> 
> Observations you want have no missing values. So 
> -nmiss- is 0 and you can count such observations
> 
> bysort shcode : egen npresent = sum(nmiss == 0) 
> 
> Actually, that could all be telescoped into one: 
> 
> bysort shcode : egen npresent = sum(!mi(dependencia) + !mi(reservas)) 
> 
> Then you are interested in panels for which -npresent > 9-. 
> 

*
*   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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index