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]

Re: st: dropping incomplete frequencies without 'missing' in panel data


From   Abdul <bihiabdul@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: dropping incomplete frequencies without 'missing' in panel data
Date   Wed, 13 Jul 2011 17:43:09 +0200

Dear Joerg,
Thank you for the much needed help. your code worked as I wanted. I
will also remember the point about bias you raised. Thanks a lot
again.
Abdul

On Wed, Jul 13, 2011 at 5:30 PM, Joerg Luedicke
<joerg.luedicke@gmail.com> wrote:
> You could do the following:
>
> bys  hhnr: gen nyears=_N
> drop if nyears<7
>
> But consider that more often than not, you do not need a completely
> balanced panel and dropping households that are not fully observed
> over the entire period of 7 years can potentially induce some sort of
> bias.
>
> J.
>
> On Wed, Jul 13, 2011 at 10:39 AM, Abdul <bihiabdul@gmail.com> wrote:
>> Dear List,
>>
>> I have a panel dataset and I wanted to drop those observations where
>> the variable 'hhnr' is missing in some time periods. for example when
>> hhnr is 6, it is only reported in 2001 and not in subsequent years,
>> whereas when hhnr is 9, it is reported in all years from 2001 to 2007.
>>
>> hhnr    year    volumew    valuew
>> 6    2001    770    4585
>> 9    2001    9374    91672
>> 9    2002    13576    145520
>> 9    2003    4720    44709
>> 9    2004    3429    30254
>> 9    2005    5589.25    43225.37
>> 9    2006    4577.1    44175.56
>> 9    2007    6079.05    74066.045
>> 13    2001    1273    11399
>> 13    2002    1705    15619
>> 13    2003    1306    11060
>> 13    2004    728    5823
>> 13    2005    331.2    2930.16
>> 13    2006    541.2    2900.175
>> 13    2007    635.6    2910.115
>> 14    2004    467    5893
>> 14    2006    360    4548
>> 14    2007    897.15    11333.995
>> 14    2007    897.15    11333.995
>> 18    2001    4308    37267
>> 18    2002    1234    13419
>>
>> If those observations where hhnr is not there were reported as missing
>> I could have used this FAQ:
>> http://www.stata.com/support/faqs/data/dropmiss.html
>> Unfortunately, they are just left out and I am unable to drop them
>> despite many attmpts. I would appreciate if you either help me with a
>> way to make them explicitly missing in this dataset or yet better if
>> you konw a way to drop them and keep only those 'hhnrs' with complete
>> frequency (reported in all years).
>>
>> Thanks,
>> Abdul
>> *
>> *   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/
>



-- 
Abdul

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