Please try the below code
data have;
input Company$ Commission:dollar6.;
cards;
I $17.75
I $15.00
I $15.00
I $13.00
I $12.50
I $10.00
I $10.00
I $9.89
I $9.15
I $9.00
I $9.00
I $8.75
I $8.50
I $8.00
I $7.25
F $15.50
F $14.00
F $14.00
F $13.00
F $13.00
F $12.50
F $12.00
F $12.00
F $12.00
F $11.50
F $11.50
F $11.50
F $11.00
F $10.50
F $10.45
F $10.00
F $10.00
F $10.00
F $9.00
;
proc sort data=have;
by company descending Commission ;
run;
data have2;
set have;
by company;
retain row;
if first.company then row=1;
else row+1;
run;
proc sql;
create table want as select company, avg(Commission) as avg from (select company, Commission,row, round((count(*)*20)/100,1) as cnt from have2 group by company having row<=calculated cnt) group by company;
quit;
... View more