TIMEAMPMw.d Format

Writes SAS time values as hours, minutes, and seconds in the form hh:mm:ss.ss with AM or PM.

Category: Date and Time
Alignment: Right

Syntax

TIMEAMPMw.[d]

Arguments

w

specifies the width of the output field.

Default 11
Range 2–20

d

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

Default 0
Range 0–19
Requirement must be less than w

Details

The TIMEAMPMw.d format writes SAS time values in the form hh:mm:ss.ss with AM or PM, where
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.
Times greater than 23:59:59 PM appear as the next day.
Make w large enough to produce the desired results. To obtain a complete time value with three decimal places and AM or PM, you must allow at least 11 spaces (hh:mm:ss PM). If w is less than 5, SAS writes AM or PM only.

Comparisons

  • The TIMEAMPMMw.d format is similar to the TIMEMw.d format except, that TIMEAMPMMw.d prints AM or PM at the end of the time.
  • TIMEw.d writes hours greater than 11:59:59, and TIMEAMPMw.d does not.

Example

The example table uses the input value of 59083, which is the SAS time value that corresponds to 4:24:43 PM.
Statements
Results
 
----+----1----+
select put(59083,timeampm3.);
 PM
select put(59083,timeampm5.);
 4 PM
select put(59083,timeampm7.);
4:24 PM
select put(59083,timeampm11.);
 4:24:43 PM
Last updated: February 23, 2017