我想在与特定商店相关的每组记录之后添加摘要记录。所以,我有这个:
Shop_id Trans_id Count
1 1 10
1 2 23
1 3 12
2 1 8
2 2 15
想要拥有这个:
Shop_id Trans_id Count
1 1 10
1 2 23
1 3 12
. . 45
2 1 8
2 2 15
. . 23
我使用PROC SQL完成了这项工作,但我想使用PROC REPORT这样做,因为我已经读过PROC REPORT应该处理这种情况。
答案 0 :(得分:1)
试试这个:
data have;
input shop_id Trans_id Count;
cards;
1 1 10
1 2 23
1 3 12
2 1 8
2 2 15
;
proc report data=have out=want(drop=_:);
define shop_id/group;
define trans_id/order;
define count/sum;
break after shop_id/summarize;
compute after shop_id;
if _break_='shop_id' then shop_id='';
endcomp;
run;