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

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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
  • 1186 views
  • 0 likes
  • 1 in conversation