比如:我想以id分组,计算income的和,以下为此写的一段程序,大家帮忙看看有什么问题吗?,date set new_sample 并没有出来理想的结果。先谢谢大家了!
data sample;
input ID$ type income @@;
cards;
1 1 200 1 2 300 1 3 100 2 1 200 2 3 100 2 4 100
;
run;
data new_sample;
set sample;
by id;
retain new_income;
if first.id then do;
new_income=0;
new_income+income;
if last.id then out new_sample;
run;