I'm trying to calculate the average difference from each persons salary from the highest salary for their job title. I keep getting an error that the summary functions are nested in a way that's not supported and can't figure out why. Heres what I have.
Hi @matoma You need an extra pass. Please calculate your max(salary)-salary in 1st pass perhaps in an in line view and the compute the Avg in the outer query.
Example:
proc sql;
select 'level 1', avg(t) format=comma12. as Avgdiff
from (select max(salary)-salary as t from hw2.mechanicslevel1)
You can complete the rest using the above as template
Hi @matoma You need an extra pass. Please calculate your max(salary)-salary in 1st pass perhaps in an in line view and the compute the Avg in the outer query.
Example:
proc sql;
select 'level 1', avg(t) format=comma12. as Avgdiff
from (select max(salary)-salary as t from hw2.mechanicslevel1)
You can complete the rest using the above as template
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.