两者最大的不同是MEANS结果是print table,而SUMMARY的结果是一个数据集。
利用output选项二者可以实现同样的功能。
例如:
proc means data=sashelp.class noprint;
var weight;
output out=summrydat1;
run;
proc summary data=sashelp.class;
var weight;
output out=summrydat2;
run;
另外,可以对统计量重命名
例如:
proc summary data=sashelp.class;
var weight;
output out=summrydat n=number mean=average std=std_deviation;
run;
proc summary data=sashelp.class;
var height weight;
output out =summrydat
n =ht_n wt_n
mean(weight)= wt_mean
std(height) = ht_std;
run;
还有,CLASS语句,类似于FREQ的CLASS语句
title1 'CLASS and a Printed Table';
proc means data=sashelp.class;
class age sex;
var height;
output out=clsummry1 n=ht_n mean=ht_mean std=ht_sd;
run;
使用CLASS语句,MEANS和SUMMARY自动生成的_TYPE_值不同,它们用来区别统计量。
“
_TYPE_ = 0 Summarize across all classification variables
总结所有分类变量
_TYPE_ = 1 Summarize as if the right most classification variable was the only one
对将数据最右边的分类变量作总结
_TYPE_ = 2 Summarize as if the next to the right most classification variable was the only one
对数据右边第二个分类变量作总结
_TYPE_ = 3 Interaction of the two classification variables.
两分类变量间交互作用
”
比如上面代码的结果为: