You did not provide enough examples of MON_QTR values to understand if it is supposed to represent MONTH or QUARTER. The values 1 to 3 could be valid for either.
Also you did not show any examples of non-positive values of MON_QTR, but your %EVAL() calculations could generate such values. Does that mean when the month part of Reportingdate is January that you only want to use data from January? But when it is March you want to use data from January, February and March?
It looks like from your code that you expect MON_QTR to have values from -1 to 12.
Note that you can use the INPUT() function to convert values like '001' into the number 1.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.