SAS中文论坛

标题: 问一base 题 [打印本页]

作者: shiyiming    时间: 2012-4-21 04:15
标题: 问一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.

求指教,另外几个选项错在那里
作者: shiyiming    时间: 2012-4-25 15:10
标题: Re: 问一base 题
column语句就列出所有变量,包括旧变量和新计算的变量,故A不对。
B中,define bedbathratio / order format=4.2; 因为要计算bedbathratio的值,故后面的选项就用computed,这和C比较便可看出。
D中,bedbathratio=baths/bedrooms;如果要在compute模块中用某变量计算新的变量,则要在要分析的旧变量之后加入一个统计符号,默认为.sum。
并不是什么求和的意思。对于变量如何计算,还要看具体的表达式。回答完毕!




欢迎光临 SAS中文论坛 (http://www.mysas.net/forum/) Powered by Discuz! X3.2