data score;
input id type $ score;
cards;
1 math 87
1 chinese 79
2 math 98
3 math 90
2 chinese 85
;
proc sort data=score;
by id; run;
data total;
set score;
by id;
if first.id then total=0;
total+score;
drop type pay;
if last.id then output;
proc print;
run;
大神能不能解释一下data total;
set score;
by id;
if first.id then total=0;
total+score;
drop type pay;
if last.id then output;
proc print;
run; 各步的意思,最后得到的结果是: