楼主: xn2xn
13155 6

请问SAS程序中by与class语句的区别? [推广有奖]

  • 1关注
  • 1粉丝

小学生

50%

还不是VIP/贵宾

-

威望
0
论坛币
18 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
102 点
帖子
6
精华
0
在线时间
5 小时
注册时间
2015-10-18
最后登录
2020-4-1

楼主
xn2xn 发表于 2015-10-19 23:25:23 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
请问SAS程序中by与class语句有什么区别?可以互换吗?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:sas程序 程序

沙发
zxn2011 发表于 2015-10-19 23:51:22
SAS的文档里对这个问题有专门的描述,大概可以包括以下几点:
1.区别不大一般可以互换
2.用by之前必须先sort 而用class则不必
3.在proc means 中如果不使用NWAY,用by则只会给出相应的分类的汇总统计数据;而用class不仅会给出相应分类的统计数据而且还会给出不同组别所有可能组合的数据的统计数据;
4.by的结果输出多个表而class只有一个表
5.一般情况下用by比class要高效
已有 1 人评分学术水平 热心指数 收起 理由
mandyfervor + 1 + 1 分析的有道理

总评分: 学术水平 + 1  热心指数 + 1   查看全部评分

藤椅
zxn2011 发表于 2015-10-19 23:52:03
Comparison of the BY and CLASS Statements
Using the BY statement is similar to using the CLASS statement and the NWAY option in that PROC MEANS summarizes each BY group as an independent subset of the input data. Therefore, no overall summarization of the input data is available. However, unlike the CLASS statement, the BY statement requires that you previously sort BY variables.
When you use the NWAY option, PROC MEANS might encounter insufficient memory for the summarization of all the class variables. You can move some class variables to the BY statement. For maximum benefit, move class variables to the BY statement that are already sorted or that have the greatest number of unique values.
You can use the CLASS and BY statements together to analyze the data by the levels of class variables within BY groups.

板凳
xn2xn 发表于 2015-10-20 00:07:02
zxn2011 发表于 2015-10-19 23:51
SAS的文档里对这个问题有专门的描述,大概可以包括以下几点:
1.区别不大一般可以互换
2.用by之前必须先s ...
多谢指教

报纸
欢薯er 发表于 2016-3-21 16:16:48
受益了

地板
smilealways193 发表于 2016-3-22 08:44:40
受教了

7
ShawnLee42 发表于 2016-7-5 21:04:43
最大的区别还是在于by语句对原始数据分组之前需要用sort by先排序,而class不需要。

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-5 01:50