We need to see test data in the form of a datastep and required output to have any chance of answering your question. As such all I can say is that proc means/summary/sql are ways of getting total counts.
Catch up on SAS Innovate 2026
Nearly 200 sessions are now available on demand in the Innovate Hub.