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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.