Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re:st: xtpcse - "no time periods are common to all panels"


From   Christopher Baum <kit.baum@bc.edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re:st: xtpcse - "no time periods are common to all panels"
Date   Fri, 18 Nov 2011 07:55:25 -0500

<>
What about

g iota = 1
egen howmany = total(iota), by(year)
tab year howmany
drop if howmany < (number of years)  where number of years refers to the entire dataset's range 
tab year howmany

Kit

On Nov 18, 2011, at 2:33 AM,Wayne wrote:

> Thanks to Kit, Gordon, and Nick for their helpful answers to my question 
> about -xtpcse-.  I had assumed that all of the panels included at least 
> some common years, but that was not the case.  There may be easier ways 
> to check this, but here is how I did it:
> 
> * how many panels are present in each year?
> tabstat year, by(year) stat(N)
> xtset panel_id year
> * what is the pattern of missing years?
> xtdescribe
> by panel_id: gen yrs=_N
> tab yrs
> sort yrs panel_id year
> * visually checking the sorted data, it was easy to see that countries 
> with fewer than 12 years of data were the problem
> drop if yrs<12
> drop yrs



Kit Baum   |   Boston College Economics & DIW Berlin   |   http://ideas.repec.org/e/pba1.html
                             An Introduction to Stata Programming  |   http://www.stata-press.com/books/isp.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/help.cgi?search
*   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   |   Site index