Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

st: centile with if

From   Ozgur Ozdemir <>
To   Stata <>
Subject   st: centile with if
Date   Fri, 6 Jan 2012 11:52:00 +0000

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' =

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

Skype : ozgurozdemir2005
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index