MDYAMPMw.d Format

Writes datetime values in the form mm/dd/yy<yy> hh:mm AM|PM. The year can be either two or four digits.

Category: Date and Time
Alignment: Right
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written using this format might differ slightly from previous releases. For more information, see DECIMALCONV= System Option in SAS System Options: Reference.
Note: The default time period is AM.

Syntax

MDYAMPMw.

Syntax Description

w

specifies the width of the output field.

Default 19
Range 8−40

Details

The MDYAMPMw.d format writes SAS datetime values in the following form:
mm/dd/yy<yy> hh:mm<AM | PM>:
mm
is an integer between 1 and 12 that represents the month.
dd
is an integer between 1 and 31 that represents the day of the month.
yy or yyyy
specifies a two-digit or four-digit integer that represents the year.
hh
is an integer between 00 and 23 that represents hours.
mm
is an integer between 00 and 59 that represents minutes.
AM | PM
specifies either the time period 00:01−12:00 noon (PM) or the time period 12:01−12:00 midnight (AM). The default is AM.
date and time separator characters
is one of several special characters, such as the slash (/), colon (:), or a blank character that SAS uses to separate date and time components.

Comparisons

The MDYAMPMw. format writes datetime values with separators in the form mm/dd/yy<yy> hh:mm AM | PM, and requires a space between the date and the time.
The DATETIMEw.d format writes datetime values with separators in the form ddmmmyy<yy>: hh:mm:ss.ss.

Example

This example uses the input value of 1663343580, which is the SAS datetime value that corresponds to 3:53:00 PM on September 15, 2012.
SAS Statement
Result
put dt mdyampm25.
9/15/2012 3:53 PM

See Also

Informats: