Hi guys,
I am very new to Stata and have to do a winsorizing on stocks characteristics in each cross-section (month). I have to winsorize at the 0.5 and 99.5 % -tiles.
Now, I tried using winsor2 variable, replace cuts(0.5, 99.5). However, this variable cannot be combined by "by" and thus does not allow for cross-sectional winsorizingj. by month_id: winsor2 does not work.
I also tried :
bys month_id: summarize marketcap,de
bys month_id: replace marketcap = r(p1) if marketcap < r(p1) & marketcap !=.
bys month_id: replace marketcap = r(p99) if marketcap > r(p99) & marketcap !=.
However, here, we can only winsorize at the 1 and 99 % -tiles. I need to winterize at 0.5% and 99.5% though.
I appreciate ny help provided !
Best, BAT
I am very new to Stata and have to do a winsorizing on stocks characteristics in each cross-section (month). I have to winsorize at the 0.5 and 99.5 % -tiles.
Now, I tried using winsor2 variable, replace cuts(0.5, 99.5). However, this variable cannot be combined by "by" and thus does not allow for cross-sectional winsorizingj. by month_id: winsor2 does not work.
I also tried :
bys month_id: summarize marketcap,de
bys month_id: replace marketcap = r(p1) if marketcap < r(p1) & marketcap !=.
bys month_id: replace marketcap = r(p99) if marketcap > r(p99) & marketcap !=.
However, here, we can only winsorize at the 1 and 99 % -tiles. I need to winterize at 0.5% and 99.5% though.
I appreciate ny help provided !
Best, BAT
Comment