Look at using the INTNX function and "MONTHS" for argument #1. Also, you can consider using a SAS output format to display year/month components only. Your code can accumulate based on the "PERIOD" derived variable:
FORMAT PERIOD YYMMS7. ;
PERIOD = INTNX('MONTH',,0);
Also, PROC SUMMARY can do the summarization for you, to include an internal sort using the CLASS statement, as well generate your _FREQ_ variable, which could feed your report step, as required. And, it's possible that PROC REPORT with GROUP can do something similar.
Scott Barry
SBBWorks, Inc.