customer_no | card_no |
1 | 00002 |
1 | 00003 |
1 | 00006 |
1 | 00008 |
2 | 00005 |
2 | 00012 |
3 | 00015 |
4 | 00020 |
我现在要分别汇总customer_no=1、2、3、4客户所拥有的卡数,请问该怎么做?
附:我用if first.customer_no then cardsum=0; cardsum=cardsum+1;的做法显示说我未初始化first.customer_no.
然后我就用proc sql来做,这是我的代码
proc sql;
create table count as
select count(distinct customer_no) as customer
from a1
;
quit;
但还是做不出正确答案。