DATEAMPMw.d Format

Writes SAS datetime values in the form ddmmmyy:hh:mm:ss.ss with AM or PM.

Category: Date and Time
Alignment: Right

Syntax

DATEAMPMw.[d]

Arguments

w

specifies the width of the output field.

Default 19
Range 7–40
Tip SAS requires a minimum w value of 13 to write AM or PM. For widths between 10 and 12, SAS writes a 24-hour clock time.

d

specifies the number of digits to the right of the decimal point in the seconds value.

Range 0–39
Requirement must be less than w
Note If wd< 17, SAS truncates the decimal values.

Details

The DATEAMPMw.d format writes SAS datetime values in the form ddmmmyy:hh:mm:ss.ss, where
dd
is an integer that represents the day of the month.
mmm
is the first three letters of the month name.
yy
is a two-digit integer that represents the year.
hh
is an integer that represents the hour.
mm
is an integer that represents the minutes.
ss.ss
is the number of seconds to two decimal places.

Comparisons

The DATETIMEw.d format is similar to the DATEAMPMw.d format except that DATETIMEw.d does not print AM or PM at the end of the time.

Example

The example table uses the input value of 1679344494, which is the SAS datetime value that corresponds to 08:34:54 PM on March 19, 2013.
Statements
Results
----+----1----+----2----+
select put (1679344494,dateampm.); 
19MAR13:08:34:54 PM
select put (1679344494,dateampm7.);
19MAR13
select put (1679344494,dateampm10.);
 19MAR13:20
select put (1679344494,dateampm13.);
 19MAR13:08 PM
select put (1679344494,dateampm22.2.); 
19MAR13:08:34:54.00 PM
Last updated: February 23, 2017