Desktop productivity for business analysts and programmers

SAS Dates, Times, and Interval Functions

Occasional Contributor
Posts: 5

SAS Dates, Times, and Interval Functions

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)


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?


Len Harbottle
Super Contributor
Super Contributor
Posts: 3,174

Re: SAS Dates, Times, and Interval Functions

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.
Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation