Hi, Is this the output you required... data have; input price size; cards; 10 3 20 5 30 5 45 1 2 3 20 5 30 5 45 1 38 3 20 5 39 5 55 1 ; run; proc univariate data=have noprint; var price size; output out=want mean=mean std=std pctlpts = 1 99 pctlpre = price size pctlname = pct1 pct99; run; proc sql; select min(price) into :minimum from have where price in(select price from have having price<>MIN(price) ); select max(price) into :maximum from have where price in(select price from have having price<>max(price) ); select min(size) into :sminimum from have where size in(select size from have having size<>MIN(size) ); select max(size) into :smaximum from have where size in(select size from have having size<>max(size) ); select pricepct1,pricepct99,sizepct1,sizepct99 into :actual1,:actual99,:size1,:size99 from want; quit; data test; merge have want; if price=&actual1 then price=&minimum; else if price=&actual99 then price=&maximum; if size=&size1 then size=&sminimum; else if size=&size99 then size=&smaximum; run; Thanks, Shiva
... View more