SAS Base Programming for SAS 9 — Question 2
The SAS data set WORK.AWARDS is listed below:
fname points
Amy 2 -
Amy 1 -
Gerard 3 -
Wang 3 -
Wang 1 -
Wang 2 -
The following SAS program is submitted:
proc sort data = work.awards;
by descending fname points;
run;
Which one of the following represents how the observations are sorted?
Answer options
- A. Wang 3 Gerard 3 Wang 2 Amy 2 Wang 1 Amy 1
- B. Wang 3 Wang 2 Wang 1 Gerard 3 Amy 2 Amy 1
- C. Wang 3 Wang 1 Wang 2 Gerard 3 Amy 2 Amy 1
- D. Wang 1 Wang 2 Wang 3 Gerard 3 Amy 1
Correct answer: D
Explanation
The correct answer is D because the sorting is done first by the 'fname' in descending order, and then by 'points' also in descending order. Wang has the highest points and appears before Gerard and Amy, while among Wangs, the points are sorted from highest to lowest.