Task
Type of
Language
Element
Language
Element Input Result
DATETIME 1679097600 17MAR13:00:00:
00
Read datetime values as SAS
datetime values
Datetime
informats
DATETIME 17MAR13:00:00:00 1679097600
Return the current date and
time of day as a SAS
datetime value
Datetime
functions
DATETIME() () The SAS
datetime value at
the moment of
execution, in the
form
NNNNNNNNNN
.N.
Interval Tasks
Return the number of
specified time intervals that
lie between the two date or
datetime values
Interval functions INTCK week2
01aug60
01jan13
1368
Advances a date, time, or
datetime value by a given
interval, and returns a date,
time, or datetime value
Interval functions INTNX day
17mar12
365
19434
*
In SAS, a Julian date is a date in the form YYNNN or YYYYNNN, where YY is a two-digit year, YYYY is a four-digit year, and NNN
is the ordinal offset from January 1 of the year YY or YYYY. SAS processes Julian dates only for valid SAS dates.
SAS also supports these formats and informats:
• ISO 8601 basic and extended forms for dates, times, datetimes, durations, intervals,
and time zones. For more information, see “Working with Dates and Times By Using
the ISO 8601 Basic and Extended Notations” in SAS Formats and Informats:
Reference and “Reading Dates and Times By Using the ISO 860 Basic and Extended
Notations” in SAS Formats and Informats: Reference.
• International formats and informats that are equivalent to some of the most
commonly used English-language date formats and informats. For more information,
see “Dictionary of Formats for NLS” in SAS National Language Support (NLS):
Reference Guide and “Dictionary of Informats for NLS” in SAS National Language
Support (NLS): Reference Guide.
Examples
Example 1: Displaying Date, Time, and Datetime Values as
Recognizable Dates and Times
The following example demonstrates how a value might be displayed as a date, a time,
or a datetime. Remember to select the SAS language element that converts a SAS date,
time, or datetime value to the intended date, time, or datetime format. See the previous
tables for examples.
Note:
About SAS Date, Time, and Datetime Values 121