I want to create a dynamic filter, which always gives me the previous 12 months from a date variable.
For example, if I run the query today, on the 24th of February 2021, I want data between the 1st of February 2020 to the 31st of January 2021.
I have tried the INTNX function, but I can't get it to do what I want.
How do I do this?
For your future benefit, saying "it didn't work" and not showing us what you did never helps. Show us what you did.
if intnx('month',today(),-12,'b')<=variable<=intnx('month',today(),-1,'e') then ...
For your future benefit, saying "it didn't work" and not showing us what you did never helps. Show us what you did.
if intnx('month',today(),-12,'b')<=variable<=intnx('month',today(),-1,'e') then ...
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.