Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: on balancing a panel data
From
Chris Parker <[email protected]>
To
[email protected]
Subject
Re: st: on balancing a panel data
Date
Mon, 13 Sep 2010 15:29:28 +0530
Sorry if this gets sent twice. I wasn't sending text only before.
gen ones=1
bysort country: egen numobs=sum(ones)
su numobs, meanonly
drop if numobs<r(max)
drop ones numobs
Should do what you want.
Chris Parker
________________________________
PhD Candidate | Management Science & Operations
London Business School | Regent's Park | London NW1 4SA | United Kingdom
Direct line +44 (0)20 7000 8816 | Email [email protected]
On Mon, Sep 13, 2010 at 3:20 PM, <[email protected]> wrote:
>
> to avoid misunderstanding i need to correct a sentence in my post:please read
> "i.e. to keep only those
>
> countries for which data is available for each year and exclude the rest" as
> "i.e. to keep only those countries that appear each year and exclude the rest".
>
> In the example I have given, this would be then countries 1 and 2.
>
>
>
> ----- Ursprüngliche Mail ----
> Von: "[email protected]" <[email protected]>
> An: [email protected]
> Gesendet: Montag, den 13. September 2010, 11:31:36 Uhr
> Betreff: st: on balancing a panel data
>
> Dear all,
>
> I have a panel data set of observations for countries over several years. The
> number of countries varies: the minimum number is 52 per year and the maximum
> number is 73. For certain reasons (graphs), I would like to make the panel
> dataset a kind of balanced and I need to have the same countries in each year
> across the sample period even if I would need to exclude some of them.
>
> Could you help me on how one can make this in Stata, i.e. to keep only those
> countries for which data is available for each year and exclude the rest. Below
> is a simplified description of the dataset:
>
> year country var1
> 1990 1 ...
> 1990 2 ...
> 1990 3
> 1991 1
> 1991 2
> 1992 1
> 1992 2
> 1992 3
> 1992 4
> 1992 5
> 1993 1
> 1993 2
> 1993 5
> ...
>
>
>
>
> *
> * 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/
>
> ______________________________________________________________________
>
> This email has been scanned by the MessageLabs Email Security System
> on behalf of the London Business School community.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
*
* 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/