Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: choosing based on number of observations


From   Michael McCulloch <[email protected]>
To   [email protected]
Subject   Re: st: choosing based on number of observations
Date   Mon, 16 Apr 2007 09:36:16 -0700

I guess you would like to keep those counties for which at least five
or more observations exist in your dataset. If that is the case this
task can be easily solved with

bysort county: keep if _N>= 5
Thank you Sebastian; this is just what I needed, and I can see its utility.
Thanks also to others who responded.
Michael

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index