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: Confusion with Winsorizing
From
Nima Darbari <[email protected]>
To
[email protected]
Subject
st: Confusion with Winsorizing
Date
Wed, 15 Jan 2014 18:30:22 +0100
I have written the simple code below to Winsorize a figure in 55
different events separately but perhaps due to a funny mistake it
doesn't work properly.
forvalues e=1(1)55{
sum PostturnoverFirm if (PostturnoverFirm !=0 & Event`e' ==1) , de
local p95=r(p95)
local p5=r(p5)
replace PostturnoverFirm = `p95' if (Event`e' ==1 & PostturnoverFirm > `p95')
replace PostturnoverFirm = `p5' if (Event`e' ==1 & PostturnoverFirm < `p5')
}
Bigger than the 95 percentile line works correctly but the smaller
than 5 percentile line replaces the figure for almost all of the rest
of observations. Does anyone know whats wrong with this?
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/