DATEAMPMw.d Format

Writes datetime values in the form ddmmmyy:hh:mm:ss.ss with AM or PM.
Category: Date and Time
Alignment: right

Syntax

DATEAMPMw.d

Syntax Description

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. This argument is optional.
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 DATEAMPMw.d format is similar to the DATETIMEw.d format except that DATEAMPMw.d prints AM or PM at the end of the time.

Example

The example table uses the input value of 1650538894, which is the SAS datetime value that corresponds to 11:01:34 a.m. on April 20, 2012.
SAS Statement
Result
----+----1----+----2----+
put event dateampm.; 
20APR12:11:01:34 AM
put event dateampm7.;
20APR12
put event dateampm10.;
20APR:11
put event dateampm13.; 
20APR12:11 AM
put event dateampm22.2; 
20APR12:11:01:34.00 AM

See Also