Language Reference

Date and Time Functions

DATDIF returns the number of days between two dates
DATE returns the current date as a SAS date value
DATEJUL converts a Julian date to a SAS date value
DATEPART extracts the date from a SAS datetime value
DATETIME returns the current date and time of day as a SAS datetime value
DAY returns the day of the month from a SAS date value
DHMS returns a SAS datetime value from date, hour, minute, and seconds
HMS returns a SAS time value from hour, minute, and seconds
HOLIDAY returns the date of the specified holiday for the specified year. Other functions that begin with the HOLIDAY prefix are also supported.
HOUR returns the hour from a SAS time or datetime value
INTCINDEX returns the cycle index when a date, time, or datetime interval and value are specified
INTCK returns the integer number of time intervals in a given time span
INTCYCLE returns the date, time, or datetime interval at the next higher seasonal cycle
INTFIT returns a time interval that is aligned between two dates
INTFMT returns a recommended SAS format when a date, time, or datetime interval is specified
INTGET returns a time interval based on three date or datetime values
INTINDEX returns the seasonal index when a date, time, or datetime interval and value are specified
INTNX advances a date, time, or datetime value by a given interval, and returns a date, time, or datetime value
INTSEAS returns the length of the seasonal cycle when a date, time, or datetime interval is specified
INTSHIFT returns the shift interval that corresponds to the base interval
INTEST returns 1 if a time interval is valid, and returns 0 if a time interval is invalid
JULDATE returns the Julian date from a SAS date value
JULDATE7 returns a seven-digit Julian date from a SAS date value
MDY returns a SAS date value from month, day, and year values
MINUTE returns the minute from a SAS time or datetime value
MONTH returns the month from a SAS date value
NWKDOM returns the date for the nth occurrence of a weekday for the specified month and year
QTR returns the quarter of the year from a SAS date value
SECOND returns the second from a SAS time or datetime value
TIME returns the current time of day
TIMEPART extracts a time value from a SAS datetime value
TODAY returns the current date as a SAS date value
WEEKDAY returns the day of the week from a SAS date value
YEAR returns the year from a SAS date value
YRDIF returns the difference in years between two dates
YYQ returns a SAS date value from the year and quarter

Last updated: July 20, 2026