|
沙发

楼主 |
发表于 2006-8-19 00:39:32
|
只看该作者
我手持钢鞭将你打
[code:da39d]data ahuige;
input id services$ quantity totalcosts ;
cards;
1 A 3 70
1 B 9 140
1 C 1 5
2 B 4 30
2 C 3 23
3 A 2 40
3 C 2 49
;
run;
proc sort ;
by id ;
run;
data final(drop=quantity totalcosts services);
set ahuige;
by id;
array temp service_A quantity_A totalcosts_A service_B quantity_B totalcosts_B service_C quantity_C totalcosts_C ;
array quant(65:67) quantity_A quantity_B quantity_C(0,0,0) ;
array totalc(65:67) totalcosts_A totalcosts_B totalcosts_C(0,0,0);
array serv(65:67) service_A service_B service_C(0,0,0);
if first.id then
do over temp;
temp=0;
end;
quant(rank(services))=quantity;
totalc(rank(services))=totalcosts;
serv(rank(services))=1;
if last.id then output;
run;
proc print;run;[/code:da39d]
我手持钢鞭将你打 |
|