Statistical Analysis System (SAS) Programming Certification Practice Exam

Disable ads (and more) with a membership for a one time $2.99 payment

Prepare effectively for the SAS Programming Certification Exam. Access flashcards and multiple choice questions, with hints and detailed explanations. Ace your exam confidently!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


Which temporary variables are available only for DATA step programming during BY-group processing?

  1. FIRST.variable and LAST.variable.

  2. _N_ and _ERROR_ variables.

  3. Both a and b.

  4. None of the above.

The correct answer is: FIRST.variable and LAST.variable.

The correct answer focuses on the temporary variables that are specifically generated during BY-group processing in a DATA step. When using BY-group processing in SAS, the system automatically creates two special temporary variables for each variable specified in the BY statement: FIRST.variable and LAST.variable. The FIRST.variable is set to 1 for the first observation of each BY group and 0 otherwise, while LAST.variable is set to 1 for the last observation of each BY group and 0 otherwise. These variables are crucial for distinguishing between different groups within the data during processing and allow programmers to implement conditional logic based on the position within each group. In contrast, the _N_ and _ERROR_ variables are built-in automatic variables in the DATA step but are not specific to BY-group processing. The _N_ variable counts the number of iterations in the DATA step, while the _ERROR_ variable indicates whether an error occurred during the data step execution. Since they are not exclusive to BY-group processing, they do not fulfill the criteria set by the question. Therefore, the answer correctly identifies FIRST.variable and LAST.variable as the temporary variables available only during BY-group processing in a DATA step.