Previous Page | Next Page

Formats

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
Syntax Description
Details
Comparisons
Examples
See Also

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.

Requirement: must be less than w
Range: 0-39

Note:   If w-d< 17, SAS truncates the decimal values.  [cautionend]


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.


Examples

The example table uses the input value of 1347455694, which is the SAS datetime value that corresponds to 11:01:34 a.m. on April 20, 2003.

SAS Statement Results

----+----1----+----2----+
put event dateampm.; 
20APR03:11:01:34 AM
put event dateampm7.;
20APR03
put event dateampm10.;
20APR:11
put event dateampm13.; 
20APR03:11 AM
put event dateampm22.2; 
20APR03:11:01:34.00 AM


See Also

Format:

DATETIMEw.d Format

Previous Page | Next Page | Top of Page