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