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: centile with if


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: centile with if
Date   Fri, 6 Jan 2012 12:01:29 +0000

It looks as if you could just add

... if mv`i' > 0

to your -centile- command. But it sounds as if an extra category
"Zero" would no harm, particularly if companies have value 0 only for
some years.

I don't see the point of coarsening quantitative variables! It's
throwing information away.

Nick

On Fri, Jan 6, 2012 at 11:52 AM, Ozgur Ozdemir <[email protected]> wrote:
>
> Hi,
> I would like to group the companies based on their market value centile however some of them have zero value and I would like to exclude them. my script below does not work as it includes the zero value companies. please can you suggest any alternative solution?
>
> forvalues i=2000/2010 {
>
> gen  Firm_Size_`i' =
> "first"
>
> replace Firm_Size_`i'="Missing" if missing(mv_`i')
>
> }
>
> forvalues i=2000/2010 {
>
> centile mv_`i', cent(25 75)
>
> replace Firm_Size_`i'="Small" if mv_`i'<=
> `r(c_1)' & Firm_Size_`i' !="missing"
>
> replace Firm_Size_`i'="Medium" if mv_`i'>
> `r(c_1)' & mv_`i'<`r(c_2)' &Firm_Size_`i' !="missing"
>
> replace Firm_Size_`i'="Large" if mv_`i'>=
> `r(c_2)' & Firm_Size_`i' !="missing"
>
> }
>
>
> kind regards
> Ozgur Ozdemir
>
> E: [email protected]
> Skype : ozgurozdemir2005
>
> *
> *   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