

111. A SAS PRINT procedure output of the WORK.LEVELS data set is listed below:
OBS NAME LEVEL
1 Frank 1
2 Joan 2
3 Sui 2
4 Jose 3
5 Burt 4
6 Kelly.
7 Juan 1
set work. levels;
if level=. then
expertise='Unknown';
else if level=1 then
expertise='Low';
else if level=2
or 3 then
expertise='Medium';
else
expertise='High';
run;
答案是EXPERTISE contain Low,Medium,and Unkonwn
不明白为什么不包含 high
---------------------------------------------------------
else if level=2 or 3; 中的or 3 永远为真,所以就不会执行后面的else了,也就是expertise不会被赋值为“High”
-----------------------------------------------------------------------------------------------------------------
87. The SAS data set BANKS is listed below:
BANKS
name rate
FirstCapital 0.0718
DirectBank 0.0721
VirtualDirect0.0728
The following SAS program is submitted:
data newbank;
do year=1 to 3;
set banks;
capital+5000;
end;
run;
答案是NEWBANK contain 1 observation and 4 variables不明白
-------------------------------------------
DATA step 默认在结束时将PDV中的变量输出到数据集中,DO语句循环3次,会读banks中的3条记录,之后遇到run;时输出到newbank中。
返回到data步开头试图读数据时因为没有观测可读,所以次data步结束。
四个变量: year,name , rate, capital
----------------------------------------------------------------------------------------
57题明白真确答案但是不明白选项A为什么错了
题目如下
the SAS data set named WORK.TEST is listed below:
capacity airplanetype staff
150 Large 10
Which one of the following SAS programs created this data set?
A.data work.test;
capacity=150;
if 100 le capacity le 200 then
airplanetype='Large' and staff=10;
else airplanetype ='Small' and staff=5;
run;
不明白这个if then/else哪里不对
------------------------------------------
if 100 le capacity le 200 then do;
airplanetype='Large';
staff=10;
end;
else do;
airplanetype ='Small';
staff=5;
end;
------------------------------------------------------------------
39. A raw data file is listed below:
----|----10----|----20----|----30
John McCloskey 35 71
June Rosesette 10 43
Tineke Jones 9 37
the following SAS program is submitted using the raw data file as input:
data work.homework;
infile 'file-specification';
input name $ age height;
if age LE 10;
run;
答案是WORK.HOMEWORK data包含3个observations,不明白为什么不是2个。
----------------------------------
因为名字包含空格,读入后变量name只包含名字的第一个单词,age为数值型变量,却试图读入字符型的值,因此自动设为缺失值,
缺失值都小于10,因此会有3条
-----------------------------------------------------------------------------------------------------------------------------
38.the SASDATA.BANKS data set has five ovservations when the following SAS program is submitted:
libname sas data' SAS0data-library';
data allobs;
set sasdata.banks;
capital=0;
do year=2000 to 2020 by 5;
capital +((capital+2000)*rate);
output;
end;
run;
How many observations will the ALLOBS data set contain?
答案是25,不明白。
--------------------------------------------
对于banks的每一条记录,DO;END; 语句循环5次,就会有5次output;
所以会有5*5=25条记录。
-----------------------------------------------------------------------------------------
33. the contents of the raw data file TEAM are listed below:
----|----10----|----20----|----30
Janice 10
Henri 11
Michael 11
Susan 12
The following SAS program is submitted:
data group;
infile 'team';
input name $15. age 2.;
file'file-specification';
put name $15. +5 age2.;
run;
which one of the following describes the output created?
答案是a SAS data set named GROUP and a raw data file
不明白put name $15. +5 age2.;难道不是错误的么
---------------------------------------------
$15. 指定输出name时的format,
put name $15. +5 age2.;
age和2.之间没有空格么?