I don't think that this is possible within the same proc report. Because proc report works from top the bottom and within that from left to right. You would need a step after that to sort the data.
I suggest you do the sum for "total" in a data step before the proc report and then do the proc report and define the new variable as order / group.
Best wishes,
Eva
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.