Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Jan Bryla <JBR@finansraadet.dk> |
To | "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |
Subject | st: RE: Converting unbalanced panel to balanced panel data |
Date | Tue, 15 Mar 2011 14:55:58 +0100 |
If you want to drop observations that are not present in all years of your study, generate an indicator for number of observations by pid, such as Bys pid: gen nyear=[_N] Keep if nyear==9 Jan Bryla The Danish Bankers Association -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Muhammad Anees Sent: 15. marts 2011 14:13 To: statalist@hsphsun2.harvard.edu Subject: st: Converting unbalanced panel to balanced panel data Hi! I know I can apply most of the panel data estimations to balanced and unbalanced panel dataset. Instead of this I would like you all to help me out of this. I have one very basic question in mind and came to no clue after intensive research of the Stata help files and over the internet. I have an unbalanced panel dataset and want to make it balanced. I would present the xtdes results at the end of my email please bear my my question first: How can I keep if all my id is present at all times so that I come with atleast balanced panel? Sorry for the very basic nature of my question. xtdes pid: 10016848, 10016872, ..., 1.794e+08 n = 16368 year: 2001, 2002, ..., 2009 T = 9 Delta(year) = 1 unit Span(year) = 9 periods (pid*year uniquely identifies each observation) Distribution of T_i: min 5% 25% 50% 75% 95% max 1 1 2 6 9 9 9 Freq. Percent Cum. Pattern ---------------------------+----------- 5110 31.22 31.22 111111111 1450 8.86 40.08 ..1111111 1187 7.25 47.33 11....... 616 3.76 51.09 1........ 486 2.97 54.06 ........1 423 2.58 56.65 .11111111 410 2.50 59.15 ......111 382 2.33 61.49 .......11 352 2.15 63.64 ..1...... 5952 36.36 100.00 (other patterns) ---------------------------+----------- 16368 100.00 XXXXXXXXX -- Muhammad Anees MSc in Economics * * 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/