PROC MEANS AND PROC SUMMARY

两者最大的不同是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.

两分类变量间交互作用

比如上面代码的结果为:

_type_=0,统计量对所有变量计算所得
_type_=1,对满足分类变量sex计算所得
_type_=2,对满足分类变量age计算所得
_type_=3,则是同时对满足分类变量sex,age计算所得
  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值