【sas note】实践

 
 1 data guanhui.usergroup1;
 2     set guanhui.usergroup;
 3     fee1=fee;
 4 run;
 5 proc format;
 6     value freqgroup
 7     low-5='1~5'
 8     6-10='5~10'
 9     11-20='10~20'
10     21-40='21-40'
11     41-high='>40';
12 run;
13 proc format;
14     value feegroup
15     low-100='1~100'
16     101-200='100~200'
17     201-500='200~500'
18     501-1000='500-1000'
19     1001-2000='1000~2000'
20     2001-high='>2000';
21 run;
22 ods html file="'E:\用户消费次数及金额分组.xls";
23 proc tabulate data=guanhui.usergroup1;
24     var fee;
25     class freq fee1;
26     table freq all,fee1*n*all;
27     format fee1 feegroup.;
28     format freq freqgroup.;
29 run;
30 ods html close;

 

原数据为号码 金额 次数三个字段,想了半天怎么能实现以金额和次数为行列的按区间统计表。

中间的种种磨难不多表

解决方案:copy复制一个金额字段,用下述代码实现--一点变通

1 proc tabulate data=guanhui.usergroup1;
2     var fee;
3     class freq fee1;
4     table freq all,fee1*n*all;
5     format fee1 feegroup.;
6     format freq freqgroup.;
7 run;

 

posted on 2013-02-20 17:06  colipso  阅读(271)  评论(0编辑  收藏  举报

导航