SAS Advanced Programming for SAS 9 — Question 32

Given the following SAS data set ONE:

ONE -

LEVEL AGE -
1 10
2 20
3 20
2 10
1 10
2 30
3 10
2 20
3 30
1 10
The following SAS program is submitted:
proc sql;
select level, max(age) as MAX
from one
group by level
having max(age) > (select avg(age) from one);
quit;
Which one of the following reports is generated?

Answer options

Correct answer: D

Explanation

The correct answer is D because the SQL query groups the data by level and selects the maximum age for each level. The condition in the HAVING clause filters out levels where the maximum age is not greater than the average age from the dataset, resulting in level 2 with a maximum age of 30 being the only entry that meets the criteria.