全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
2074 5
2013-05-22
QUESTION 14
A raw data file is listed below:
RANCH,1250,2,1,Sheppard Avenue,"$64,000"
SPLIT,1190,1,1,Rand Street,"$65,850"
CONDO,1400,2,1.5,Market Street,"80,050"
TWOSTORY,1810,4,3,Garris Street,"$107,250"
RANCH,1500,3,3,Kemble Avenue,"$86,650"
SPLIT,1615,4,3,West Drive,"94,450"
SPLIT,1305,3,1.5,Graham Avenue,"$73,650"
The following SAS program is submitted using the raw data file as input:
data work.condo_ranch;
infile'file-specification' dsd;
input style $ @;
if style = 'CONDO' or style = 'RANCH';
input sqfeet bedrooms baths street $ price : dollar10.;
run;
How many observations will the output data set contain?
A. 0
B. 3
C. 5
D. 7

不明白答案为什么为B,烦请大家解释一下~~
二维码

扫码加我 拉你入群

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

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

全部回复
2013-5-23 14:28:27
if style = 'CONDO' or style = 'RANCH';
二维码

扫码加我 拉你入群

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

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

2013-5-23 16:03:01
style = 'CONDO' or style = 'RANCH'只有1,3,5行,所以有3组observations.
二维码

扫码加我 拉你入群

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

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

2013-5-23 16:41:04
满足if条件的只有3条观测值
RANCH,1250,2,1,Sheppard Avenue,"$64,000"
CONDO,1400,2,1.5,Market Street,"80,050"
RANCH,1500,3,3,Kemble Avenue,"$86,650"
二维码

扫码加我 拉你入群

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

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

2018-7-24 04:20:59
同问,为什么用来解释第13题的理由在这里不适用?
Reason being statement "input style $ @;" will hold input stream until next input statement. Program will read next input statement only if style is condo or ranch. But even when style is not condo or ranch when run statement is executed output will be written with just style variable having value and all others will be missing.
二维码

扫码加我 拉你入群

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

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

2018-7-24 04:27:04
在其他地方找到答案了,贴上来
同上(13题),if中没有then,判断为false时候,后面的语句都将不被执行。隐含在run里面的output将不被执行。
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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