连老师的 (ssc install) winsor2 很方便使用:
- In defult, winsor2 winsorize wage at 1th and 99th percentiles,
- . winsor2 wage, replace cuts(1 99)
- which can be done by hands:
- . replace wage=1.930993 if wage<1.930993
- . replace wage=38.70926 if wage>38.70926
- Note that, values smaller than the 1th percentile is repalce by the 1th percentile, and the similar thing is done with the 99th percentile.
- Things change when -trim- option is specified:
- . winsor2 wage, replace cuts(1 99) trim
- which can also be done by hands:
- . replace wage=. if wage<1.930993
- . replace wage=. if wage>38.70926
复制代码