As usual I tried to first find information on how to do this elsewhere
but was unable to find it. This seems like a fairly easy problem, but it
eludes me.
I have an unbalanced panel and would like to delete all the observations
for which I don't have the whole date range.
year panelid x
1 1 5
2 1 3
3 1 4
1 2 7
3 2 4
In this example I would like to delete panelid 2. So that in the end I
have data for every possible year for every panelid. I tried to drop if
the sum of the years is not equal to the sum of all the 6 years I have
data for (1998 to 2003), but that just left me with the last year of my
data.
I used bysort panelid: drop if sum(year) ~= 12003