BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
cosmid
Lapis Lazuli | Level 10

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!

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

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.

View solution in original post

2 REPLIES 2
Astounding
PROC Star

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.

cosmid
Lapis Lazuli | Level 10

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!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1086 views
  • 3 likes
  • 2 in conversation