Date Intervals, Formats, and Functions

Date and Datetime Informats

Table 2 lists some of the SAS date and datetime informats available to read date, time, and datetime values. For a discussion of the use of date and datetime informats, see Chapter 3, Working with Time Series Data. For a complete description of these informats, see SAS Programmers Guide: Essentials.

For each informat, Table 2 shows an example of a date or datetime value written in the style that the informat is designed to read. You can specify the width of each informat by adding w. For informats that include second values, you can specify the number of decimal digits for seconds by adding d. Table 2 shows the width range allowed by the informat and the default width. The date 17 October 1991 and the time 2:25:32 p.m. are used for the example in all cases.

Table 2: Frequently Used SAS Date and Datetime Informats

Informat Example Description Width Range Default Width
ANYDTDTEw. Reads and extracts the date value from any 5–32 9
of the following: DATE, DATETIME, DDMMYY,
JULIAN, MDYAMPM, MMDDYY, MMxYY*,
MONYY, TIME, YMDDTTM, YYMMDD,
YYQ, YYxMM*, month-day-year
ANYDTDTMw. Reads and extracts the datetime value from any 1–32 19
of the following: DATE, DATETIME, DDMMYY,
JULIAN, MMDDYY, MMxYY*, MONYY,
TIME, YYMMDD, YYQ, YYxMM*,
month-day-year
ANYDTTMEw. Reads and extracts the time value from any 1–32 8
of the following: DATE, DATETIME, DDMMYY,
JULIAN, MMDDYY, MONYY, TIME,
YYMMDD, YYQ, month-day-year
DATEw. 17oct91 Day, month abbreviation, and year: 7–32 7
ddmonyy
DATETIMEw.d 17oct91:14:45:32 Date and time: ddmonyy:hh:mm:ss 13–40 18
DDMMYYw. 17/10/91 Day, month, year: ddmmyy, dd/mm/yy, 6–32 6
dd-mm-yy, or dd mm yy
JULIANw. 91290 Year and day of year (Julian dates): yyddd 5–32 5
MMDDYYw. 10/17/91 Month, day, year: mmddyy, mm/dd/yy, 6–32 6
mm-dd-yy, or mm dd yy
MONYYw. Oct91 Month abbreviation and year: monyy 5–32 5
NENGOw. H.03/10/17 Japanese Nengo notation 7–32 10
TIMEw.d 14:45:32 Hours, minutes, seconds: hh:mm:ss 5–32 8
or hours, minutes: hh:mm
WEEKVw. 1991-W42-04 ISO 8601 year, week, day of week: yyyy-Www-dd 3–200 11
YYMMDDw. 91/10/17 Year, month, day: yymmdd, yy/mm/dd, 6–32 6
yy-mm-dd, or yy mm dd
YYQw. 91Q4 Year and quarter of year: yyQq 4–32 4


Last updated: June 19, 2025