BookmarkSubscribeRSS Feed
LenHarbottle
Fluorite | Level 6
When trying to use the interval function (intnx) to calculate the dates for the Monday of the previous 4 weeks based upon todays date, I am being returned a spureous date for week3.

Select Data:

Today = today()
Week1 = INTNX('week1.2',today(),0)
Week2 = INTNX('week2.2',today(),0)
Week3 = INTNX('week3.2',today(),0)
Week4 = INTNX('week4.2',today(),0)

Output:

Today = 02/06/2010
Week1 = 31/05/2010
Week2 = 24/05/2010
Week3 = 31/05/2010 (should be 17/05/2010)
Week4 = 10/05/2010

Any ideas?

Regards

Len Harbottle
1 REPLY 1
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Suggest you review the SAS INTNX DOC on how you want to use the INTNX function with the WEEK value and a "multiple" *AND* and a "shift-index". Possibly you want to be incrementing (actually it would be decrementing) argument #3 instead for a prior period start date? Maybe it would be helpful to explain what you are trying to accomplish with the SAS expressions?

Scott Barry
SBBWorks, Inc.

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
  • 1 reply
  • 2270 views
  • 0 likes
  • 2 in conversation