全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
12975 7
2013-01-13
QUESTION 32
The contents of the SAS data set named PERM.STUDENTS are listed below:
name age
Alfred 14
Alice13
Barbara 13
Carol 14
The following SAS program is submitted using the PERM.STUDENTS data set as
input:
Libnameperm 'SAS-date-library';
data students;
set perm.students;
file 'file-specification';
put name $15. @5 age 2.;
run
Which one of the following represents the values written to the output raw data file?

A. ----|----10---|----20---|----30
Alfred 14
Alice 13
Barbara 13
Carol 14
B. ----|----10---|----20---|----30
Alfr14
Alic13
Barb13a
Caro14
C. ----|----10---|----20---|----30
Alfr14ed
Alic13e
Barb13ara
Caro14l
D. ----|----10---|----20---|----30
Alfred 14
Alice 13
Barbara 13
Carol 14
  Answer: B  为什么答案是b呢?
QUESTION 39
A raw data file is listed below:
----|----10---|----20---|----30
John McCloskey 35 71
June Rosesette 10 43
TinekeJones 9 37
The following SAS program is submitted using the raw data file as inpu
data work.homework;
infile 'file-specification';
input name $ age height;
if age LE 10;
run;
How many observations will the WORK.HOMEWORK data set contain

A. 0
B. 2
C. 3
D. No data set is created as the program fails to execute due to errors.
Answer: C (为什么是c呢,变量name读取不就有问题嘛?后面的变量能正常读出来吗?)QUESTION 93
The following SAS program is submitted:
proc sort data = sasuser.houses out = houses;
by style;
run;
proc print data = houses;
<insert statement(s) here>
run;
Click on the Exhibit button to view the report produced.
style bedrooms baths price
CONDO 2 1.5 80050
3 2.5 79350
4 2.5 127150
2 2.0 110700
RANCH 2 1.0 64000
3 3.0 86650
3 1.0 89100
1 1.0 34550
SPLIT 1 1.0 65850
4 3.0 94450
3 1.5 73650
TWOSTORY 4 3.0 107250
2 1.0 55850
2 1.0 69250
4 2.5 102950
Which of the following SAS statement(s) create(s) the report?

A. id style;
B. id style;
var style bedrooms baths price;

C. id style;
var style bedrooms baths price;
D. id style;
by style;
var style bedrooms baths price;

Answer: C(单不说b、c选项一样,id里面加了style变量,var后面也加了style变量,那么在输出中不就是有两个style了吗?)




二维码

扫码加我 拉你入群

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

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

全部回复
2013-1-17 00:17:47
Q32:
下面两个程序可以得到答案。PUT函数在第五个字符出输出年龄,覆盖之前的字符。
data students1;
infile cards;
input name $ age;
cards;
Alfred 14
Alice 13
Barbara 13
Carol 14
;
run;

data students;
set students1;
file 'C:\SAS Study\students.txt';
put name $15. @5 age 2.;
run;
二维码

扫码加我 拉你入群

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

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

2013-1-17 00:32:53
Q39:
参考以下程序。之后,是log信息。表明数据格式错误,第一,第二个observations 的
variable AGE 的值missing,为'.';第三个observation的值为9。都符合 if age le 10 的条件。
所以输出三个observations到data set.
SAS程序在执行过程中,如果数据格式错误,该数据为缺失,并在log中显示错误信息。
程序继续执行。

data homework;
infile cards;
input name $ age height;
if age le 10;
cards;
John McCloskey 35 71
June Rosesette 10 43
TinekeJones 9 37
;
run;

======
16   data homework;
17   infile cards;
18   input name $ age height;
19   if age le 10;
20   cards;

NOTE: Invalid data for age in line 21 6-14.
RULE:      ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9-
21         John McCloskey 35 71
name=John age=. height=35 _ERROR_=1 _N_=1
NOTE: Invalid data for age in line 22 6-14.
22         June Rosesette 10 43
name=June age=. height=10 _ERROR_=1 _N_=2
NOTE: The data set WORK.HOMEWORK has 3 observations and 3 variables.
NOTE: DATA statement used (Total process time):
      real time           0.17 seconds
      cpu time            0.04 seconds

24   ;
25   run;
二维码

扫码加我 拉你入群

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

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

2013-1-17 00:47:56
Q32:

参考如下程序。PUT语句在第五个字符处输出年龄,覆盖之前的字符。

data students1;
infile cards;
input name $ age;
cards;
Alfred 14
Alice 13
Barbara 13
Carol 14
;
run;

data students;
set students1;
file 'C:\SAS Study\students.txt';
put name $15. @5 age 2.;
run;
二维码

扫码加我 拉你入群

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

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

2013-1-17 22:08:49
bjtoronto 发表于 2013-1-17 00:32
Q39:
参考以下程序。之后,是log信息。表明数据格式错误,第一,第二个observations 的
variable AGE 的值 ...
这题我明白了,谢谢你的解答,的确数据集里面前两个是missing的,后面一个是存在的。因为missing也是小于10的,所以答案是三个。
二维码

扫码加我 拉你入群

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

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

2013-1-17 22:08:57
bjtoronto 发表于 2013-1-17 00:32
Q39:
参考以下程序。之后,是log信息。表明数据格式错误,第一,第二个observations 的
variable AGE 的值 ...
这题我明白了,谢谢你的解答,的确数据集里面前两个是missing的,后面一个是存在的。因为missing也是小于10的,所以答案是三个。
二维码

扫码加我 拉你入群

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

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

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群