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
Answer: B
注解:问几行数据构成一个观测值,每次DATA step循环一共会执行3个INPUT statement,默认需要3行来完成一个观测值。但第一个INPUT statement末尾有一个@,意味着在执行第二个INPUT时不换行读取数据,每个观测值需要2行数据。@的具体解释详见SAS Base (2)。
好像正确答案是A哎 类似的http://sascert.blogspot.com/2006/12/base-sas_116630508906579290.html大家也都选A
这题中 if State=’ ‘ 时input最后是没有@的,所以input NumEmployees;会成为单独的data record
Have to say you are wrong. You need to understand how @ works rather than just hard-memorize answers. The quiz from your link is different from this one – it’s using @ all through to the end thus only 1 record is read. But this one here doesn’t.