Pages

Tuesday 30 October 2012

NOTE: Seasonal Cycles and Date Increments (once more unto the breach)

I've posted a couple of articles recently about the INTNX and INTCK functions for dealing with date/time/datetime manipulation. Whilst researching these I stumbled across some related functions that I'd not heard of before. These functions manipulate date/time/datetime values around seasonal cycles (i.e. days within weeks, months within years, etc.) and provide other useful facilities.

Seasonal Cycles

INTSEASReturns the length of the seasonal cycle when a date, time, or datetime interval is specified.
INTCINDEXReturns the cycle index when a date, time, or datetime interval and value are specified.
INTCYCLEReturns the date, time, or datetime interval at the next higher seasonal cycle when a date, time, or datetime interval is specified.
INTINDEXReturns the seasonal index when a date, time, or datetime interval and value are specified.

Other Useful Date Functions

INTFITReturns a time interval that is aligned between two dates.
INTFMTReturns a recommended SAS format when a date, time, or datetime interval is specified.
INTGETReturns a time interval based on three date or datetime values.
INTSHIFTReturns the shift interval that corresponds to the base interval.
INTTESTReturns 1 if a time interval is valid, and returns 0 if a time interval is invalid.

They're the kind of functions that are life-savers to some, and of little or no interest to others. If you're in the former category and you've not heard of them before, then I'm glad to have been of service!...