全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
3331 2
2013-01-08
1.A realtor has two customers. One customer wants to view a list of homes selling for
less than $60,000. The other customer wants to view a list of homes selling for
greater than $100,000.
Assuming the PRICE variable is numeric, which one of the following PRINT
procedure steps will select all desired observations?
A. proc print data = sasuser.houses;
where price lt 60000;
where price gt 100000;
run;
B. proc print data = sasuser.houses;
where price lt 60000 or price gt 100000;
run;
C. proc print data = sasuser.houses;
where price lt 60000 and price gt 100000;
run;
D. proc print data = sasuser.houses;
where price lt 60000 or where price gt 100000;
run;

答案是B 但是我认为A是不是也可以?

2.

The following SAS program is submitted:
data work.test;
Author = 'Agatha Christie';
First = substr(scan(author,1,' ,'),1,1);
run;
Which one of the following is the length ofthe variable FIRST in the output data
set?
A. 1
B. 6
C. 15
D. 200
Answer: D

为什麽答案是D?

3.
The following SAS program is submitted:
data work.test;
Title = 'A Tale of two Cities, Charles j.Dickens';
Word = scan(title,3,' ,');
run;
Which one of the following is the value of the variable WORD in the output data
set?
A. T
B. of
C. Dickens
D. ' ' (missing character value)
Answer: B


为什麽答案是B?

4.
The following SAS DATA step is submitted:
data work.accountting;
set work.department;
length jobcode$ 12;
run;
The WORK.DEPARTMENT SAS data set contains a character variable named
JOBCODE with a length of 5.
Which one of the following is the length of the variable JOBCODE in the output
data set?
A. 5
B. 8
C. 12
D. The length can not be determined as the program fails to execute due to errors.
Answer: A

为什麽答案是A不是C?

5.
The following SAS program is submitted:
data work.staff;
JobCategory= 'FA';
JobLevel= '1';
jobCategory= JobCategory || JobLevel;
run;
Which one of the following is the value of the variable JOBCATEGORY in the
output data set?
A. FA
B. FA1
C. FA 1
D. ' ' (missing character value)
Answer: A
为什麽答案是A不是B或者C?原理是什麽?
6.A SAS PRINT procedure output of the WORK.LEVELS data set is listed below:
Obsname level
1 Frank 1
2 Joan 2
3 Sui 2
4 Jose 3
5 Burt 4
6 Kelly .
7 Juan 1
The following SAS program is submitted:
data work . expertise;
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;
Which of the following values does the variable EXPERTISE contain?
A. Low, Medium, and High only
B. Low, Medium, and Unknown only
C. Low, Medium, High, and Unknown only
D. Low, Medium, High, Unknown, and ' ' (missing character value)

为什麽答案是B 不是C?

谢谢!
二维码

扫码加我 拉你入群

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

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

全部回复
2013-1-9 11:08:55
1、
A. proc print data = sasuser.houses;
where price lt 60000;
where price gt 100000;
run;

只有where price gt 100000生效(只有放在后面的where生效)

2、如果不用length设置first的长度,scan函数为目标变量设定缺省长度为200

3、这题是不是答案出错了,我用sas代码测试了,答案选D

4、数据集.DEPARTMENT中的JOBCODE长度为5. 且set work.department;在length jobcode$ 12;语句之前,sas是逐句编译的,则前面的代码决定了长度

5、同4题,JobCategory= 'FA'; 这里jobCategory已经被决定长度为2

6、else if level = 2 or 3 then expertise =' Medium';编译的时候,会自动将这个式子or 3自动判断为 TRUE.所以,不会出来High

----------------------------
二维码

扫码加我 拉你入群

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

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

2013-1-10 10:22:24
thank u very much
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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