ANYDTDTEw. Informat

Reads and extracts the date value from various date, time, and datetime forms.
Category: Date and Time

Syntax

ANYDTDTEw.

Syntax Description

w
specifies the width of the input field.
Default:9
Range:5–32

Details

The ANYDTDTE informat reads input data that corresponds to any of the following informats or date, time, or datetime forms and extracts the date part from the derived value.
Informat or Form of Input
Example Data
Informat or Form of Input
Example Data
DATE
01JAN12
01JAN2012
MONYY
JAN12
JAN2012
DATETIME
01JAN12 14:30:08
01JAN2012 14:30:08.5
TIME
14:30
14:30:08.05
DDMMYY
010112
01012012
YMDDTTM
12-01-01 11:23
JULIAN
12001
2012001
YYMMDD
120101
20120101
MDYAMPM
01-01-12 3:53 pm
YYQ
12Q1
2012Q1
MMDDYY
010112
01012012
YY<YY>xMM 1
12/01
2012-01
MMxYY<YY> 1
01/12
01-2012
month-day-year
January 1, 2012
1x is a special character that separates the month from the year.
If the input value is a time-only value, then SAS assumes a date of 01JAN1960.
It is possible for input data such as 01-02-03 or 01-02 to be ambiguous with respect to the month, day, and year. In this case, the DATESTYLE system option indicates the order of the month, day, and year.

Comparisons

The ANYDTDTE informat extracts the date part from the derived value. The ANYDTDTM informat extracts the datetime part. The ANYDTTME informat extracts the time part.

Example

input dateinfo anydtdte21.;
Data Line
Informat Form
Result
Formatted with the DATEw. Format
----+----1----+----2
01JAN12
DATE
18993
01JAN12
01JAN2012 14:30:08.5
DATETIME
18993
01JAN12
01012012
DDMMYY
18993
01JAN12
2012001
JULIAN
18993
01JAN12
01/01/12
MMDDYY
18993
01JAN12
JAN2012
MONYY
18993
01JAN12
14:30
TIME
0
01JAN60
20120101
YYMMDD
18993
01JAN12
12q1
YYQ
18993
01JAN12
January 1, 2012
none
18993
01JAN12