bysort shcode : egen npresent = sum(!mi(dependencia) + !mi(reservas))
would be better as
bysort shcode : egen npresent = sum(!mi(dependencia) & !mi(reservas))
Nick
[email protected]
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/