Bookmark and Share

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: RE: How to drop observations


From   natasha agarwal <[email protected]>
To   [email protected]
Subject   Re: st: RE: How to drop observations
Date   Mon, 14 Nov 2011 18:43:05 +0000

Hi Nick,

Thanks for the help. Yes I did. I tried the number of distinct
observations and the sum command as well.

Thanks,
Natasha

On Mon, Nov 14, 2011 at 6:09 PM, Nick Cox <[email protected]> wrote:
> This is two questions not one.
>
> 1. Keeping only firms who switch.
>
> bysort firm (year) : drop if status[1] == status[_N]
>
> Those firms have the same status at the end as the beginning.
>
> bysort firm (status) : drop if status[1] == status[_N]
>
> Those firms never change their status.
>
> Or
>
> bysort firm : keep if status[1] == 0 & status[_N] == 1
>
> for 0 to 1 switches from beginning to end.
>
> See also the FAQ
>
> http://www.stata.com/support/faqs/data/diff.html
>
> which is just a twist away from your problem. Did you search the FAQs before posting?
>
> 2. Keeping only part of a panel. I am not clear about your exact rules, but check out the data management FAQs.
>
> Nick
> [email protected]
>
> natasha agarwal
>
> I want to estimate a model only on those firms where the exporting
> status switches from non-export to export.So for instance.
>
> Firm Year Export Status
> A      2001    0
> A      2002    0
> A      2003    0
> A      2004    1
> A      2005    1
> B      2001    0
> B      2002    0
> B      2003    0
>
> In this I want to drop firm B as it does not change its export status.
> Moreover, for firm A, I want to keep only observation uptil 2004.
>
>
> *
> *   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index