Chapter Contents

Previous

Next
DATEAMPMw.d

DATEAMPMw.d



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
optionally specifies the number of digits to the right of the decimal point in the seconds value.
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 DATETIMEMw.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 1347453583, which is the SAS datetime value that corresponds to 12:39:43 PM on September 12, 2002.

SAS Statements Results

----+----1----+----2----+
put event dateampm.; 
12SEP02:12:39:43 PM
put event dateampm7.;
12SEP02
put event dateampm10.;
12SEP02:12
put event dateampm13.; 
12SEP02:12 PM
put event dateampm22.2; 
12SEP02:12:39:43.00 PM


See Also

Format:

DATETIMEw.d


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.