32.4k views
4 votes
When you submit the following program, what will be listed in the log?

data work.holdings;
set work.catalog end=last;
if _n_=1 then
putlog 'books';
if last then do;
putlog 'last of books';
putlog _all_;
end;
run;
a. Books, last of books, and the values of all the variables for the last observation
b. Books, last of books, and the values for all the variables in all observations
c. The values of all the variables for the last observation

1 Answer

3 votes

Final answer:

When you submit the provided SAS program, what will be listed in the log is a. Books, last of books, and the values of all the variables for the last observation.

Step-by-step explanation:

The log will display 'Books', 'last of books', and the values of all variables for the last observation in the dataset when the provided SAS program is submitted.

The program uses conditional statements to control what gets written to the log. The first condition, if _n_=1, checks if the first observation is being processed, in which case it will write 'books' to the log. The second condition, if last, checks if the last observation is being processed because of the end=last option in the set statement.

If it's indeed the last observation, it writes 'last of books' to the log and uses the putlog _all_; statement to write the values of all variables from the last observation to the log.

User MWillemse
by
8.4k points