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

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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