Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

st: Partially balancing an unbalanced panel data set


From   A Loumiotis <antonis.loumiotis@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Partially balancing an unbalanced panel data set
Date   Thu, 17 Jun 2010 14:55:23 +0300

Dear Statalist,

I have a panel dataset that contains quarterly balance sheets of
corporations that belong to the Athens stock exchange (ASE) starting
from the first quarter of 2006 and ending at the fourth quarter of
2009.  This panel dataset is unbalanced because of two reasons.
First, there are companies in the panel dataset that were listed in
the (ASE) after the first quarter of 2006 or exited the ASE before the
fourth quarter of 2009.  Second data for some quarters data are
missing for some companies although there were in the ASE. What I want
to do is to partially balance this dataset so that it corrects the
second reason that the panel set is unbalanced but not the first.
Last I would like to fill in the missing values with the average of
the previous and the next value.

Here is a sample unbalanced panel dataset with the issues that I
describe above where for simplicity I only consider the four quarters
of 2009:

companyid   quarter   assets
      100            1           150
      100            2           155
      100            3           157
      100            4           158
      101            1            65
      101            3            74
      101            4            77
      102            3           109
      102            4           111
      103            1           170
      103            2           175
      103            3           177

So the problem with the above dataset is with company 101 that quarter
two is missing but quarter one and quarter three exists.

My partially balanced panel data set should then look like:

companyid   quarter   assets
      100            1           150
      100            2           155
      100            3           157
      100            4           158
      101            1            65
      101            2              .
      101            3            74
      101            4            77
      102            3           109
      102            4           111
      103            1           170
      103            2           175
      103            3           177

I would then like to fill the missing with average of the previous and
the next value so that my dataset finally looks like:

companyid   quarter   assets
      100            1           150
      100            2           155
      100            3           157
      100            4           158
      101            1            65
      101            2            69.5
      101            3            74
      101            4            77
      102            3           109
      102            4           111
      103            1           170
      103            2           175
      103            3           177

Thanks,

Antonis Loumiotis
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index