Statalist


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

st: Re: Modified Question: Manipulating an Unbalanced Panel


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: Modified Question: Manipulating an Unbalanced Panel
Date   Sat, 22 Nov 2008 12:52:23 +0100

Try -h statsby-

HTH
Martin _______________________ ----- Original Message ----- From: "ippab ippab" <ippab.statalist@gmail.com>
To: <statalist@hsphsun2.harvard.edu>
Sent: Saturday, November 22, 2008 3:25 AM
Subject: st: Modified Question: Manipulating an Unbalanced Panel


Hello All,

I just realized that I can generate a variable with the number of
panels with the following command: by  PanelNumber: gen CountSessions
= _N .

But, in my data, there is another variable which indicates if that
observation has any positive consumption.  I actually need to count
the number of positive consumptions for each panel.  There are
sessions without any consumption.  For example, I used "by
PanelNumber: gen CountSessions = _N   if  consumption>0".  This is
wrong because this gives CountSessions =2 even if a panel has one
session (observation) with positive consumption  and one session
(observation) without any consumption.

I found that the following command gives me the right output on the
screen: "by  PanelNumber: count   if  consumption>0".   However, I
don't know how to generate a variable to capture the output for the
command:  "by PanelNumber: count   if  consumption>0".  I would really
appreciate some help with this.

Thanks in advance!

Best,

ippab

---------- Forwarded message ----------
From: ippab ippab <ippab.statalist@gmail.com>
Date: Fri, Nov 21, 2008 at 6:08 PM
Subject: st: Manipulating an Unbalanced Panel
To: statalist@hsphsun2.harvard.edu


Hi All,

I have an unbalanced panel data set where the number observations per
group varies from 1 to 9.  When I run the xtreg command, it includes
the panels (groups) that have only one observation.  I would like to
analyze panels that have at least 2 observations.  Could you please
help me in excluding panels with 1 observation from my analysis?  What
would be the easiest way to exclude panels (groups) with only one
observation?

Thanks a lot in advance!

Best regards,

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


*
*   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   |   What's new   |   Site index