Reads and extracts time values from various date, time, and datetime
forms.
-
w
-
specifies the width of the input field.
The ANYDTTME informat reads input data
that corresponds to any of the following informats or forms.
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 |
YYMMDD |
090101
20090101 |
DDMMYY |
010109
01012009 |
YYQ |
09Q1
2009Q1 |
JULIAN |
09001
2009001 |
YYQ |
09Q1
2009Q1 |
MMDDYY |
010109
01012009 |
month-day-year
|
January 1, 2009 2009-01 |
If the input value is a time-only value, then
SAS assumes
a date of 01JAN1960. If the input value is a date value only, then SAS assumes
a time of 12:00 midnight.
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.
The ANYDTTME informat uses the following rules when reading colons and
periods in time values:
Use of Colons and Periods |
Example |
a single colon in the value h:m indicates hours and minutes |
14:30 |
two colons in the value h:m:s indicate hours, minutes, and seconds |
14:30:08 |
a single period in the value m:s.ff, where ff is a fraction of a second,
indicates that the number preceding the period is the number of seconds |
2:39.66 |
multiple periods in the value indicate that the period is a delimiter
for dates and the value is not a time value. |
12.25.2009 |
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.
input dateinfo anydttme21.;
Data Line |
Informat |
Results |
Formatted with the TIMEw.d Format |
----+----1----+----2
|
|
|
|
01JAN09
|
DATE |
0
|
00:00:00
|
01JAN2009 14:30:08.5
|
DATETIME |
52208.5
|
14:30:09
|
010109
|
DDMMYY |
0
|
00:00:00
|
2009001
|
JULIAN |
0
|
00:00:00
|
01012009
|
MMDDYY |
0
|
00:00:00
|
JAN2009
|
MONYY |
0
|
00:00:00
|
14:30:08.5
|
TIME |
52208.5
|
14:30:09
|
20090101
|
YYMMDD |
0
|
00:00:00
|
09Q1
|
YYQ |
0
|
00:00:00
|
January 1, 2009
|
month-day-year
|
0
|
00:00:00
|
Copyright © 2011 by SAS Institute Inc., Cary, NC, USA. All rights reserved.