全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
8336 5
2010-08-18
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
-----------------------------------------------------------------------------------------------------------------
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不明白
----------------------------------------------------------------------------------------

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哪里不对
------------------------------------------------------------------

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个。
-----------------------------------------------------------------------------------------------------------------------------

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,不明白。
-----------------------------------------------------------------------------------------

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.;难道不是错误的么

SAS才学习了一个多月水平比较菜,无奈最近要考试,希望不吝指教,多谢
二维码

扫码加我 拉你入群

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

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

全部回复
2010-8-18 08:01:56
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.之间没有空格么?
二维码

扫码加我 拉你入群

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

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

2010-8-18 08:44:30
谢谢LS

age和2.之间有空格的
put name $15. +5 age 2.;
这个是指15个字符后再移动五个字符再输入age么
或者是输入name之后移动5个空格?
这样不是超过age的范围了么,是变成missing data么
二维码

扫码加我 拉你入群

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

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

2010-8-18 09:10:24
srorange 发表于 2010-8-18 08:44
谢谢LS

age和2.之间有空格的
put name $15. +5 age 2.;
这个是指15个字符后再移动五个字符再输入age么
或者是输入name之后移动5个空格?
这样不是超过age的范围了么,是变成missing data么
中间没有空格会报错。

+5 是指15个字符后再加五个空格再输出age。
输出的时候是从pdv中拿出相应的变量,再放到指定的地方,与变量的位置和长度是没有关系的。
data test;
   input name $5. age;
   put age 2. +10 name $10. +10 age 2.;
   datalines;
Tom  13
Jack 24
;
二维码

扫码加我 拉你入群

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

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

2010-8-18 09:25:13
put的问题明白了
else if level=2 or 3; 中的or 3 永远为真,所以就不会执行后面的else了,也就是expertise不会被赋值为“High”
能问最后一个问题么,为什么or 3永远为真
二维码

扫码加我 拉你入群

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

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

2010-8-18 10:02:26
srorange 发表于 2010-8-18 09:25
put的问题明白了
else if level=2 or 3; 中的or 3 永远为真,所以就不会执行后面的else了,也就是expertise不会被赋值为“High”
能问最后一个问题么,为什么or 3永远为真
If condition1 or condition2 then ...

这一句中condition1 和condition2有一个为真时,就会执行then后面的语句。
而对于每一个条件,只要其结果非0就认为是真。
condition1: level=2     当变量level的值是2时为真,否则为假;
condition2: 3,    非零,所以永远为真

这个题考的是阅读理解,不是sas水平。
二维码

扫码加我 拉你入群

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

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

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

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