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]
st: centile with if
From
Ozgur Ozdemir <[email protected]>
To
Stata <[email protected]>
Subject
st: centile with if
Date
Fri, 6 Jan 2012 11:52:00 +0000
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/