Previous Page | Next Page

Informats

ANYDTDTEw. Informat



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

Syntax
Syntax Description
Details
Comparisons
Examples
See Also

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 01JAN09

01JAN2009

MONYY JAN09

JAN2009

DATETIME 01JAN09 14:30:08

01JAN2009 14:30:08.5

TIME 14:30

14:30:08.05

DDMMYY 010109

01012009

YMDDTTM 08-03-16 11:23
JULIAN 09001

2009001

YYMMDD 090101

20090101

MDYAMPM 09-15-08 3:53 pm YYQ 09Q1

2009Q1

MMDDYY 010109

01012009

YY<YY>xMM* 09/01

2009-01

MMxYY<YY>* 01/09

01-2009

month-day-year
January 1, 2009
* x 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.


Examples

input dateinfo anydtdte21.;

Data Line Informat Form Results Formatted with the DATEw. Format
----+----1----+----2



01JAN09
DATE
17898
01JAN09
01JAN2009 14:30:08.5
DATETIME
17898
01JAN09
01012009
DDMMYY
17898
01JAN09
2009001
JULIAN
17898
01JAN09
01/01/09
MMDDYY
17898
01JAN09
JAN2009
MONYY
17898
01JAN09
14:30
TIME
0
01JAN60
20090101
YYMMDD
17898
01JAN09
09q1
YYQ
17898
01JAN09
January 1, 2009
none
17898
01JAN09


See Also

Informats:

ANYDTDTMw. Informat

ANYDTTMEw. Informat

DATEw. Informat

DATETIMEw. Informat

DDMMYYw. Informat

JULIANw. Informat

MDYAMPMw.d Informat

MMDDYYw. Informat

MONYYw. Informat

TIMEw. Informat

YMDDTTMw.d Informat

YYMMDDw. Informat

YYQw. Informat

Previous Page | Next Page | Top of Page