SAS中文论坛

 找回密码
 立即注册

扫一扫,访问微社区

查看: 1189|回复: 1
打印 上一主题 下一主题

问一base 题

[复制链接]

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
楼主
 楼主| 发表于 2012-4-21 04:15:03 | 只看该作者

问一base 题

Which program does not contain an error?

proc report data=sasuser.houses nowd;
   column style bedrooms baths;
   define style / order;
   define bedbathratio / computed format=4.2;
   compute bedbathratio;
      bedbathratio=baths.sum/bedrooms.sum; endcomp;
run;

proc report data=sasuser.houses nowd;
   column style bedrooms baths BedBathRatio;
   define style / order;
   define bedbathratio / order format=4.2;
   compute bedbathratio;
      bedbathratio=baths.sum/bedrooms.sum; endcomp;
run;

proc report data=sasuser.houses nowd;
   column style bedrooms baths BedBathRatio;
   define style / order;
   define bedbathratio / computed format=4.2;
   compute bedbathratio;
      bedbathratio=baths.sum/bedrooms.sum; endcomp;
run;

proc report data=sasuser.houses nowd;
   column style bedrooms baths BedBathRatio;
   define style / order;
   define bedbathratio / computed format=4.2;
   compute bedbathratio;
      bedbathratio=baths/bedrooms;
   endcomp;
run;

Correct answer: c

Program c correctly specifies a computed variable in the COLUMN statement, defines the variable in a DEFINE statement, and computes values using the form variable-name.statistic in a compute block.

求指教,另外几个选项错在那里
回复 支持 反对

使用道具 举报

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
沙发
 楼主| 发表于 2012-4-25 15:10:52 | 只看该作者

Re: 问一base 题

column语句就列出所有变量,包括旧变量和新计算的变量,故A不对。
B中,define bedbathratio / order format=4.2; 因为要计算bedbathratio的值,故后面的选项就用computed,这和C比较便可看出。
D中,bedbathratio=baths/bedrooms;如果要在compute模块中用某变量计算新的变量,则要在要分析的旧变量之后加入一个统计符号,默认为.sum。
并不是什么求和的意思。对于变量如何计算,还要看具体的表达式。回答完毕!
回复 支持 反对

使用道具 举报

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

本版积分规则

QQ|小黑屋|手机版|Archiver|SAS中文论坛  

GMT+8, 2025-5-6 12:59 , Processed in 0.066567 second(s), 20 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表