由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - 请问一道SAS BASE的题目,THANKS~~~
相关主题
请教Base 70 中的一题 关于@SAS base 70 题第29 和 31题
请教sas base 70题里第29题。。。[合集] 请教一个SAS数据input的问题
菜鸟麻烦大家帮我看看sas base 70题的29和123题的15题question about SAS BASE 123 NO.110
sas base 70 key -errors刚刚考完SAS base,补充一下
sas base 70的两道题SAS问题,关于@和@@的区别
sas base question help (70)问几道SAS base 123的题
70 题中的第29题答案是不是错了啊?请教SAS问题:这个code有什么办法简化吗?
请帮忙解答两个SAS base考题SAS 问题请教
相关话题的讨论汇总
话题: input话题: year话题: state话题: data话题: sas
进入Statistics版参与讨论
1 (共1页)
b******y
发帖数: 499
1
base 123里第29题:
29.The following SAS program is sumbitted:
data WORK.INFO;
infile 'DATAFILE.TXT';
input @1 Company $20. @25 State $2. @;
if State=' ' then input @30 Year;
else input @30 City Year;
input NumEmployees;
run;
How many raw data records are read during each iteration of the DATA step?
A. 1
B. 2
C. 3
D. 4
答案是B,为什么呢?是哪两条RECORDS?
p*********o
发帖数: 138
2
题目是不是没有贴全啊?
d******9
发帖数: 404
3
Yes, the answer is correct.
At each data step iteration,
input @1 Company $20. @25 State $2. @;
if State=' ' then input @30 Year;
else input @30 City Year;
All the above codes will read in ONE record from the external txt file. It
read in Company and State value first, then read in either Year only, or City and Year both, from the same record, depends on the value of State of current record.
Then,
input NumEmployees;
this INPUT statement will load a new record into the input buffer. Therefore
, 2 records will be read at each data step iteration,
b******y
发帖数: 499
4
我也是这么想的,可是又看见另一道题跟这个基本一样,但是答案却是A。请问这两道
题差别在那里?
The following SAS program is submitted:
data numrecords;
infile 'file-specification';
input @1 patient $15.
relative $ 16-26 @;
if relative = 'children' then
input @54 diagnosis $15. @;
else if relative = 'parents' then
input @28 doctor $15.
clinic $ 44-53
@54 diagnosis $15. @;
input age;
run;
How many raw data records are read during each iteration of the DATA step
during execution?
A. 1
B. 2
C. 3
D. 4

City and Year both, from the same record, depends on the value of State of
current record.
Therefore

【在 d******9 的大作中提到】
: Yes, the answer is correct.
: At each data step iteration,
: input @1 Company $20. @25 State $2. @;
: if State=' ' then input @30 Year;
: else input @30 City Year;
: All the above codes will read in ONE record from the external txt file. It
: read in Company and State value first, then read in either Year only, or City and Year both, from the same record, depends on the value of State of current record.
: Then,
: input NumEmployees;
: this INPUT statement will load a new record into the input buffer. Therefore

b******y
发帖数: 499
5
贴全了。

【在 p*********o 的大作中提到】
: 题目是不是没有贴全啊?
k*******a
发帖数: 772
6
题目意思是读了几行把
第一题里面 读完 city后,重新有个input,而这个input之前没有 @ (line holding)
,所以必须重启一行,这样就读2行
第二题里面新的input前面有 @,所以还是原来那行继续读,最终只读一行
d******9
发帖数: 404
7
请注意:
input @1 patient $15.relative $ 16-26 @;
if relative = 'children' then input @54 diagnosis $15. @;
else if relative = 'parents' then input @28 doctor $15.
clinic $ 44-53 @54 diagnosis $15. @;
上面的每个 INPUT 之后都有一个 @, it will continue to hold the current record
in input buffer.Therefore, the following:
"input age;"
will read the SAME record !
So, the correct answer is A !

【在 b******y 的大作中提到】
: 我也是这么想的,可是又看见另一道题跟这个基本一样,但是答案却是A。请问这两道
: 题差别在那里?
: The following SAS program is submitted:
: data numrecords;
: infile 'file-specification';
: input @1 patient $15.
: relative $ 16-26 @;
: if relative = 'children' then
: input @54 diagnosis $15. @;
: else if relative = 'parents' then

b******y
发帖数: 499
8
明白了,谢谢解答!
1 (共1页)
进入Statistics版参与讨论
相关主题
SAS 问题请教sas base 70的两道题
[合集] SAS data input helpsas base question help (70)
请教一个SAS数据input的问题70 题中的第29题答案是不是错了啊?
SAS数据输入疑问请帮忙解答两个SAS base考题
请教Base 70 中的一题 关于@SAS base 70 题第29 和 31题
请教sas base 70题里第29题。。。[合集] 请教一个SAS数据input的问题
菜鸟麻烦大家帮我看看sas base 70题的29和123题的15题question about SAS BASE 123 NO.110
sas base 70 key -errors刚刚考完SAS base,补充一下
相关话题的讨论汇总
话题: input话题: year话题: state话题: data话题: sas