Statalist


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

Re: st: How to balance an unbalanced panel data set


From   Christian Bustamante <[email protected]>
To   [email protected]
Subject   Re: st: How to balance an unbalanced panel data set
Date   Thu, 2 Apr 2009 21:15:23 -0500

Hi Martin
This is a better example:

 ---------------
| year  id  var1|
|---------------|
| 1998  01   .  |
| 1999  01   .  |
| 2000  01   34 |
| 2001  01   23 |
| 2002  01   25 |
|---------------|
| 1998  02   56 |
| 1999  02   45 |
| 2000  02   67 |
| 2001  02   47 |
| 2002  02   .  |
|---------------|
| 1998  03   11 |
| 1999  03   13 |
| 2000  03   .  |
| 2001  03   .  |
| 2002  03   23 |
|---------------|
| 1998  04   44 |
| 1999  04   24 |
| 2000  04   33 |
| 2001  04   36 |
| 2002  04   41 |
|---------------|
| 1999  05   24 |
| 2000  05   35 |
| 2002  05   45 |
|---------------|

In this example I only want the panel with id 04 with data in all the
years, and drop the panels 01, 02 and 03 with a missing value in at
least one year for var1. I also want to drop the panel 05 with doesn't
have values in all years.

On Thu, Apr 2, 2009 at 4:37 PM, Martin Weiss <[email protected]> wrote:
> <>
>
> You ought to give a much clearer excerpt of your data.
>
> If it is really as simple as the one below, use -egen myrowmiss, rowmiss()-
> and you can easily drop depending on whether the row has any missings by
> -drop if myrowmiss >0 & !mi(myrowmiss)-.
>
>
> HTH
> Martin
> _______________________
> ----- Original Message ----- From: "Christian Bustamante" <[email protected]>
> To: <[email protected]>
> Sent: Thursday, April 02, 2009 10:50 PM
> Subject: Re: st: How to balance an unbalanced panel data set
>
>
>> Hi and thanks for your response. That's not what I'm looking for. I
>> will be more explicit.
>> Supose the folliwing data set with each row represents a panel
>> observations for a variable:
>>
>> 1 2 3 4 5 6 7 8
>> . . 3 4 5 6 7 8
>> 1 2 3 . 5 6 7 8
>> 1 2 3 4 5 6 7 .
>> 1 2 3 4 5 . . .
>>
>> I want to keep only the observations like the first one and drop the
>> others.
>>
>> Bests
>>
>>
>>
>> On Thu, Apr 2, 2009 at 3:31 PM, Philipp Rehm <[email protected]> wrote:
>>>
>>> .
>>>
>>> http://www.stata.com/support/faqs/data/panel.html
>>>
>>> HTH,
>>> Philipp
>>>
>>> Christian Bustamante wrote:
>>>>
>>>> Hi Statalisters,
>>>>
>>>> I have a very unbalanced panel data set, composed for a lot of panel
>>>> and 12 years. I'm interested in "balance" this panel, keeping only the
>>>> panel tha have information for a set of variables in all the period.
>>>> How can I do that?
>>>>
>>>> Thanks
>>>>
>>> *
>>> * 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/
>>>
>>
>>
>>
>> --
>> CdeB
>>
>> *
>> *   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/
>>
>
> *
> *   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/
>



-- 
CdeB

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index