BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I am looking to use the MAX function, but I want it to find the MAX by different variable groupings. How do I do this?
1 REPLY 1
deleted_user
Not applicable
You can try something like this:

PROC SUMMARY DATA=my_data NWAY;
CLASS by_var1 byvar2;
OUTPUT OUT=my_output MAX(var1 var2 var3)=var1 var2 var3;
RUN;

(there is also the option maxid to preserve some id variable (eg: names, data, time, etc...))

Best regards
Jaroslav Message was edited by: Jaroslav

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 1 reply
  • 1125 views
  • 0 likes
  • 1 in conversation