|
Chapter Contents |
Previous |
Next |
| Working with Time Series Data |
The SAS interval functions INTNX and INTCK perform calculations with date, datetime values, and time intervals. They can be used for calendar calculations with SAS date values, to count time intervals between dates, and to increment dates or datetime values by intervals.
The INTNX function increments dates by intervals. INTNX computes the date or datetime of the start of the interval a specified number of intervals from the interval containing a given date or datetime value.
The form of the INTNX function is
INTNX( interval, from, n <, alignment > )
where:
The number of intervals to increment, n, can be positive, negative, or zero.
For example, the statement NEXTMON = INTNX('MONTH',DATE,1); assigns to the variable NEXTMON the date of the first day of the month following the month containing the value of DATE.
The INTCK function counts the number of interval boundaries between two dates or between two datetime values.
The form of the INTCK function is
INTCK( interval, from, to )
where:
For example, the statement NEWYEARS = INTCK('YEAR',DATE1,DATE2); assigns to the variable NEWYEARS the number of New Year's Days between the two dates.
|
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.