Here is the original question and answer:
Which temporary variables are available for DATA step programming during BY-group processing only, but are not added to the data set?
a. FIRST.variable and LAST.variable
b. _N_ and _ERROR variables.
c. Both a and b.
d. None of the above.
Correct Answer: a
Explanation in back of book:
In the DATA step, during BY-group processing only, the temporary variables FIRST.variable and LAST.variable are available for DATA step programming, but they do not appear in the output data set.
My question is why isn't the correct answer to be c?
1. Is it because it's asking for temporary variables and automatic variables doesn't count? If so, this question is lame.
2. Because they intentionally misspelled _ERROR_ and _ERROR in this case doesn't count? If so, this question is even more lame.
3. Or is it because _N_ and _ERROR_ aren't available for BY-group processing? If so, they really need to edit this book. Many improvements can be made.
Thanks in advance for your help!
They are all available. But you did not read the question carefully enough. Which are available with BY group processing ONLY. _N_ and _ERROR_ are available for all DATA steps, whether there is a BY statement or not. FIRST. and LAST. are available only when there is a BY statement.
They are all available. But you did not read the question carefully enough. Which are available with BY group processing ONLY. _N_ and _ERROR_ are available for all DATA steps, whether there is a BY statement or not. FIRST. and LAST. are available only when there is a BY statement.
Ahh...thanks for pointing that out! I was focused on the BY-group processing while the question was focused on the two variables.
I will read questions more carefully next time. Thank you!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.