Exam A00-211 All QuestionsBrowse all questions from this exam
Question 22

Given the SAS data set ONE:

Given the SAS data set WORK.ONE:

The following SAS program is submitted:

Which report is produced?

    Correct Answer: A

    The SAS program provided first sets the data set WORK.ONE by the variables X and Y. The 'by X Y;' statement indicates that the data should be processed in order of X and then Y. The 'if First.Y;' condition filters the records to only include the first occurrence for each value of Y within each value of X. The resultant data set WORK.TWO will only contain the rows where Y is the first occurrence within each group of X and Y. Based on these operations, the correct output should be 'Option A', where only the first occurrences of Y for each group of X and Y are present.

Discussion
mhminkovOption: B

given answer B is correct, .. the code is interleaving one data set (sorting effect) and the if statement is removing the second observation "1 A 33" as it is the second one (not FIRST.Y) for the variable Y. data one; infile datalines; input x y $ z; datalines; 1 A 27 1 A 33 1 B 45 2 A 52 2 B 69 3 B 70 4 A 82 4 C 91 ; data two; set one; by X Y; if first.Y; run; proc print data=two noobs; run;