-winsor- doesn't support a -by()- option or -by:-.
Your options include rewriting it so that it does,
or
(say)
gen winsor = .
su year, meanonly
qui forval y = `r(min)'/`r(max)' {
winsor response if year == `y', <winsor_options> gen(temp)
replace winsor = temp if year == `y'
drop temp
}
Nick
[email protected]
Neil Shephard replied to KK
> > I am working with a time series and interested in winsorizing a
> > variable by year. What is the easiest way to do this? Thanks, KK
> >
>
> .findit winsor
>
> suggests that you might want to try installing and using the
> -winsor- command.
>
> DESCRIPTION/AUTHOR(S)
>
> winsor takes the non-missing values of a variable and
> generates a
> new variable identical except that the h highest and h lowest
> values are replaced by the next value counting inwards from the
> extremes. h can be specified directly or indirectly by
> specifying a fraction p of the number of observations: h = [p
> n]. This transformation is named after the biostatistician C.P.
> Winsor. This is version 1.3.0 of the software.
>
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/