Hi All,
I do not know how to use MAX IF function in SAS EG so that I can get the following output.
Given the left two columns, how can I get the output table (table only, not report) like below? Prefer using EG Query Builder, if cannot, code is also good for me. Thank you so much!
School | Score | Max Score of the School | Min Score of the School |
---|---|---|---|
IT | 98 | 98 | 70 |
Biz | 80 | 99 | 80 |
Biz | 88 | 99 | 80 |
Law | 97 | 97 | 84 |
IT | 70 | 98 | 70 |
Law | 84 | 97 | 84 |
IT | 78 | 98 | 70 |
Biz | 99 | 99 | 80 |
Law | 86 | 97 | 84 |
The easiest point-and-click method is two queries: first to calc the Min/Max for each school group, then the second to join that result with the original detail.
In screen shots, with this data:
STEP 1:
STEP 2:
The flow:
Result:
Chris
The easiest point-and-click method is two queries: first to calc the Min/Max for each school group, then the second to join that result with the original detail.
In screen shots, with this data:
STEP 1:
STEP 2:
The flow:
Result:
Chris
Hi Chirs,
Thank you very much. I found that actually just the second step is enough. MAX(score) Group by school.
Thanks
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.