I have an unbalanced panel in Stata with 3 years (2006, 2008 and 2010) and 13,768 IDs. I executed the command xtdescribe and got:
Freq. Percent Cum. | Pattern*
---------------------------+----------
8265 49.80 49.80 | 111
2672 16.10 65.90 | 1..
2241 13.50 79.40 | 11.
1779 10.72 90.12 | ..1
923 5.56 95.69 | .11
413 2.49 98.17 | .1.
303 1.83 100.00 | 1.1
---------------------------+----------
16596 100.00 | XXX
--------------------------------------
*Each column represents 2 periods.
I want to keep just IDs that have observations for all three years.
I tried to implement a simple command like
keep pid if syear == 2006 & syear == 2008 & syear == 2010
and
keep if syear == 2006 & syear == 2008 & syear == 2010
but they are just wrong because in first case the syntax is invalid and in the second case I just deleted all observations.
How can I keep observations only for IDs that have observations through the whole time period (for three years 2006, 2008 and 2010)?