# st: how to balance a panel?

 From Claudio Cruz Cazares To statalist@hsphsun2.harvard.edu Subject st: how to balance a panel? Date Tue, 20 May 2008 17:47:57 +0200

```Dear all!,

I`m working in my Phd. dissertation but a have not find a solution for a crucial problem, hope you could help me.

I have an unbalanced panel data of 4050 firms in 16 years but I have monotone and intermittent (since I clean the data from missing values of my dependent variables) missingness and as far as I know, the intermittent missingnes could cause problems when estimating fist differences.

I wonder if someone could tell me how could I clean the sample. The easiest thing would be to balance it, but even I can see, after xtdes command, how many firms are in all periods, I can not find de way to keep just them. Is there any way to select the firms based upon their pattern?
Other solution is to eliminate the intermittent observations and keep those who died during the panel and those who growth within the panel, but how can I do that?

I have generated a new variable in order to identify the missingness of a firm in a year.

quietly by Identi: gen dy=year-year[_n-1]

dy would be = 1 if there are non missing observation of the firm. Then, I drop the firms with a dy > 1. But I still have intermittent missigness!

xtdes

Freq.  Percent    Cum. |  Pattern
---------------------------+-----------------
577     18.89  18.89 |  111111111111111
158      5.17   24.06 |  11 . . . . . . . . . . . . .
150      4.91   28.97 |  1 . . . . . . 11111111
136      4.45   33.42 |   . . . . . . . . . . 11111
131      4.29   37.71 |  111111111111  . . .
126      4.12   41.83 |  1 . . . . . . . .  . . . . . .
126      4.12   45.96 |  1111 . . . . 111 . . . .
116      3.80   49.75 |  111 . . . . . . . . . . .  .
88      2.88   52.64  |  111111 . . . . . . . 11
1447     47.36  100.00 | (other patterns)
---------------------------+-----------------
3055    100.00         |  XXXXXXXXXXXXXXX

Claudio

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