Dear Forum,

i would like to winsorize my data in order to controll/minimze the influence of outliers. My dataset consists of ROA figures for severaly companies within several industries. The ROA is listed in one variable for all companies and the industry is specified in a industry dummy variable. Given that the ROA is vastly differing between industries i dont want to winsorize directly my whole ROA variable but winsorize within the frame of each industry and use e.g. the 5 and 95% of e.g. Manufacturing for ROAs of companies within Manufacturing. I installed the winsor package and used the code

winsor ROA, p(.05) gen(ROA) if Manufacturing==1

However i get the error message r(198) "option if() not allowed". How could i then apply different Winsorization frames for subsets of variables?

Many thanks in advance!