楼主: 水色青空
2661 2

请教一道SAS BASE题: if then 和if的区别? [推广有奖]

  • 0关注
  • 0粉丝

大专生

31%

还不是VIP/贵宾

-

威望
0
论坛币
799 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
553 点
帖子
29
精华
0
在线时间
51 小时
注册时间
2009-10-25
最后登录
2024-3-15

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
13. 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' then
input sqfeet bedrooms baths street $ price : dollar10.;
run;

How many observations does the WORK.CONDO_RANCH data set contain?
A. 0
B. 3
C. 5
D. 7

ANS:D


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 notcondo or ranch when run statement is executed output will be written with just style variablehaving value and all others will be missing.
                                       
                                
                        
               

14. A raw data file is listed below:R
ANCH,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

ans: B
这两题差不多,唯一的区别就是一个是if...then...另一个只有if,想问下这两个区别到底在哪里,如何理解?谢谢!
                                
                        
               
二维码

扫码加我 拉你入群

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

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

关键词:SAS base Base Then The observations following style file

沙发
teqel 发表于 2016-7-12 04:02:59 来自手机 |只看作者 |坛友微信交流群
水色青空 发表于 2016-7-12 00:01
13. A raw data file is listed below:
RANCH,1250,2,1,Sheppard Avenue,"$64,000"
SPLIT,1190,1,1,Rand  ...
关键是隐藏了一个output

使用道具

藤椅
水色青空 发表于 2016-7-13 04:54:37 |只看作者 |坛友微信交流群
teqel 发表于 2016-7-12 04:02
关键是隐藏了一个output
哪里隐藏了?

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-25 14:17