Without any data or seeing the code you've tried, it's hard to make much of a suggestion, but I would be tempted to use PROC REPORT and something like the program below.
cynthia
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.