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 on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: Drop observations of groups with 0 as critical value


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Drop observations of groups with 0 as critical value
Date   Sat, 4 Jun 2011 15:59:52 +0100

egen anyzero = total(debtratio == 0), by(gvkey)
drop if anyzero

Nick

Felix/Achmed Aldai

> Below find an extract of my data set.
>
>
> gvkey           debtratio
> 1001            0,2
> 1001            0,23
> 1001            0,23
> 1001            0,23
> 1001            0,25
> 1200            0,05
> 1200            0
> 1200            0
> 1200            0
>
>
> I want to drop all the firms that have a zero debtratio. Meaning that once the debtratio becomes 0 I want to drop all the observations of this company (gvkey). So in the end I should only be left with firms that all have a nonzero debtratio.

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