BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
matoma
Obsidian | Level 7

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.Annotation 2020-02-12 153648.png

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

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

View solution in original post

1 REPLY 1
novinosrin
Tourmaline | Level 20

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

Catch up on SAS Innovate 2026

Dive into keynotes, announcements and breakthroughs on demand.

Explore Now →
How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 976 views
  • 0 likes
  • 2 in conversation