YMDDTTMw.d Informat

Reads datetime values in the form <yy>yy-mm-dd hh:mm:ss.ss, where special characters such as a hyphen (-), period (.), slash (/), or colon (:) are used to separate the year, month, day, hour, minute, and seconds; the year can be either 2 or 4 digits.
Category: Date and Time
Alignment: right

Syntax

YMDDTTMw.d

Syntax Description

w
specifies the width of the output field.
Default:19
Range:13−40
d
specifies the number of digits to the right of the decimal point in the seconds value. The digits to the right of the decimal point specify a fraction of a second. This argument is optional.
Default:0
Range:0−39

Details

The YMDDTTMw.d format reads SAS datetime values in the form <yy>yy-mm-dd hh:mm:<ss<.ss>>:
yy or yyyy
specifies a two- or four-digit integer that represents the year.
mm
is an integer between 01 and 12 that represents the month.
dd
is an integer between 01 and 31 that represents the day of the month.
hh
is an integer between 00 and 23 that represents hours.
mm
is an integer between 00 and 59 that represents minutes.
ss.ss
is the number of seconds ranging from 00–59 with the fraction of a second following the decimal point.
requirement If a fraction of a second is specified, the decimal point can be represented only by a period and is required.
- or :
represents one of several special characters, such as the slash (/), hyphen (-), colon (:), or a blank character that can be used to separate date and time components. Special characters can be used as separators between any date or time component and between the date and the time.

Comparisons

The YMDDTTMw.d informat reads datetime values with required separators in the form <yy>yy-mm-dd/hh:mm:ss.ss.
The MDYAMPMw.d in format reads datetime values with optional separators in the form mm-dd-yy<yy> hh:mm:ss.ss AM | PM, and requires a space between the date and the time.
The DATETIMEw.d informat reads datetime values with optional separators in the form dd-mmm-yy<yy> hh:mm:ss.ss AM|PM, and the date and time can be separated by a special character.

Example

input @1 dt ymddttm24.;
Data Line
Result
2012-03-16 11:23:07.4
1647516187.4
2012 03 16 11 23 07.4
1647516187.4
12.3.16/11:23
1647516180