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.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

Register now

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
  • 2328 views
  • 0 likes
  • 2 in conversation