SAS Base (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

Check Answer
Answer: B

注解:问几行数据构成一个观测值,每次DATA step循环一共会执行3个INPUT statement,默认需要3行来完成一个观测值。但第一个INPUT statement末尾有一个@,意味着在执行第二个INPUT时不换行读取数据,每个观测值需要2行数据。@的具体解释详见SAS Base (2)

3 thoughts to “SAS Base (29)”

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

Leave a Reply

Your email address will not be published. Required fields are marked *