【SAS NOTE】tabulate
1 data mysas.mms; 2 infile 'E:\SAS\mysas\mms.txt' dlm='09'x firstobs=2; 3 input date city wangnei wangjian guoji shangxing wangneid wangjiand guojid 4 alld allwangnei allwangjian allguoji allall upfeetiao downfeetiao; 5 run; 6 proc print data=mysas.mms; 7 run; 8 proc tabulate data=mysas.mms; 9 class date; 10 var wangnei; 11 table date all,sum*wangnei*ALL; 12 run;
tabulate过程可以用于生成交叉表,列联表,其中变量可以进行运算。注意 table后的变量顺序是页,行,列,并且中间用逗号隔开。
--------------------------------------
| | Sum |
| |------------|
| | wangnei |
| |------------|
| | All |
|-----------------------+------------|
|date | |
|-----------------------| |
|201207 | 36452433.00|
|-----------------------+------------|
|201208 | 31663842.00|
|-----------------------+------------|
|201209 | 34185344.00|
|-----------------------+------------|
|201210 | 38972453.00|
|-----------------------+------------|
|201211 | 33754486.00|
|-----------------------+------------|
|201212 | 45384882.00|
|-----------------------+------------|
|All |1998704690.0|
--------------------------------------