As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.


Here are some tips for How to share your SAS knowledge with your professional network.


INTNX function

From sasCommunity
(Redirected from INTNX Function)
Jump to: navigation, search

The INTNX function manipulates dates, times or datetimes and allows SAS to calculate the beginning, end, or middle of a period or time interval or a corresponding date in another period or time interval, for a given date, time or datetime. Periods can be expressed in terms of seconds, minutes, hours, days, weeks, months, years or custom periods with part and multiple periods and variable stating points also able to be set.

The INTNX function has a broad range of applications including reporting and time series analysis. If a dataset contains dates, times or datetimes of events then the INTNX function will readily allow those events to be aggregated into reporting periods.

Syntax

INTNX(period, inputdateortime, increment [, position])
where:
period is a character variable, or constant, that describes the period by its basic interval, periodic multiple and its start point offset.
inputdateortime is a date, time or datetime variable, (or constant), that is used as the starting point to calculate the resulting target period.
increment is an integer variable, or constant, that indicates how many periods to advance (positive values) or retard (negative values) to the target period.
position is a character variable, or constant, that specifies the function return the beginning, end, middle or same day of the target period. (optional) If omitted then the beginning date, time or datetime of the target period is calculated.

Intervals

A wide range of intervals are available for working with dates, including.

YEAR 
SEMIYEAR 
QTR 
MONTH 
WEEK 
DAY 

When working with Date-Times put DT in front of the above names e.g. DTYEAR, DTMONTH, etc.

When working with Date-Times and Times the following intervals can also be used.

HOUR 
MINUTE 
SECOND ;


For more information see:

See also

SAS Support links