Hi PG, Thank you for your response. I wrote the following code, based on your suggestion, but for some reason, I received different result than when winsoring manually (for verification). Also, I don't see "output data" of "FM_quadric_regr11_Winz", and when I remove the condition " where _TYPE_ = 'PARMS'" from the "proc summary" I still receive the same results (the same value of " winz_year_of_tenure2" for example) which don't make sense. Could you please try to see what I wrote incorrectly? The code I wrote: proc sort data=WORK.QUERY_FOR_FINAL1_0001 out=FM_quadric_reg1; by gvkey ; run; PROC REG DATA=FM_quadric_reg1 outest=FM_quadric_regr11 noprint outseb; MODEL y = x1 x2; by gvkey ; RUN; QUIT; proc summary data=FM_quadric_regr11; var intercept x1 x2; output out=FM_quadric_regr11_summ p5= p95= / autoname; where _TYPE_ = 'PARMS'; quit; data FM_quadric_regr11_Winz; merge FM_quadric_regr11 FM_quadric_regr11_summ; intercept = min(max(intercept, intercept_p5), intercept_p95); x1 = min(max(x1, x1_p5), x1_p95); x2 = min(max(x2, x2_p5), x2_p95); quit; proc means data=FM_quadric_regr11_Winz n mean t probt; where _TYPE_ = 'PARMS'; run; Thank you, Lior
... View more