Statalist


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

Re: st: how to balance a panel?-Thanks


From   Claudio Cruz Cazares <[email protected]>
To   [email protected]
Subject   Re: st: how to balance a panel?-Thanks
Date   Wed, 21 May 2008 12:29:44 +0200

Hi Davide!,

Thank you very much!, your trick works perfect!!

Best regards

Claudio

----- Mensaje original -----
De: Davide Cantoni <[email protected]>
Fecha: Martes, Mayo 20, 2008 6:13 pm
Asunto: Re: st: how to balance a panel?

> Hello Claudio,
> 
> this is the trick I use when I want to balance a panel (y is the
> outcome variable):
> 
> *** begin code
> 
> sort id year
> by id: egen nonmissing1to7 = count(y) if (year==1 | year==2 | year==3
> | year==4 | year==5 | year==6 | year==7)
> keep if nonmissing1to7==7
> 
> *** end code
> 
> Maybe there are more elegant solution around, but this one always
> works fine for me.
> 
> Best
> 
> Davide
> 
> 
> 
> 2008/5/20 Claudio Cruz Cazares <[email protected]>:
> > 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
> >
> >
> >
> >
> > Thanks in advance
> >
> > 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/
> >
> *
> *   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/
> 

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