Statalist The Stata Listserver


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

st: re: balanced sub-panel to test for selection bias


From   Kit Baum <[email protected]>
To   [email protected]
Subject   st: re: balanced sub-panel to test for selection bias
Date   Thu, 24 May 2007 07:53:30 -0400

sacrificial samovar

Olga wrote

Thank you very much for your help, but last command
results in removing
ALL my observations. Maybe I am doing smth wrong?


egen nfarm = count(farm),by(year)
summarize nfarm, meanonly
by year: keep if nfarm == `r(max)'


Yes, you must be doing something wrong (perhaps mangling the punctuation around r(max)?) as it must be true that at least one farm has the maximum number of observations signalled by the summarize command. Try putting in

tab nfarm

after the summarize and see what the distribution of the count is in your sample. I tried this with a hacked version of the Grunfeld data and it worked fine. Then take out the -tab- and try the lines above exactly as punctuated.



Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html


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