BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Pontus_77
Calcite | Level 5

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?

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

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 ...

 

--
Paige Miller

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

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 ...

 

--
Paige Miller
Pontus_77
Calcite | Level 5
OK. I will save my trials in the future, so I can display them here if needed.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 850 views
  • 0 likes
  • 2 in conversation