HHMMw.d Format

Writes time values as hours and minutes in the form hh:mm.
Category: Date and Time
Alignment: right

Syntax

HHMMw.d

Syntax Description

w
specifies the width of the output field.
Default:5
Range:2–20
d
specifies the number of digits to the right of the decimal point in the minutes value. The digits to the right of the decimal point specify a fraction of a minute. This argument is optional.
Default:0
Range:0–19
Requirement:must be less than w

Details

The HHMMw.d format writes SAS time values in the form hh:mm:
hh
is an integer.
Note: If hh is a single digit, HHMMw.d places a leading blank before the digit. For example, the HHMMw.d. format writes 9:00 instead of 09:00.
mm
is an integer between 00 and 59 that represents minutes.
SAS rounds hours and minutes that are based on the value of seconds in a SAS time value.
The HHMM format uses asterisks to format values that are outside the time range 0–24 hours, such as datetime values.

Comparisons

The HHMMw.d format is similar to the TIMEw.d format except that the HHMMw.d format does not print seconds.
The HHMMw.d format writes a leading blank for a single-hour digit. The TODw.d format writes a leading zero for a single-hour digit.

Example

The example table uses the input value of 46796, which is the SAS time value that corresponds to 12:59:56 p. m.
SAS Statement
Result
 
----+----1
put time hhmm.;
13:00
put time hhmm8.2;
12:59.93
In the first example, SAS rounds up the time value four seconds based on the value of seconds in the SAS time value. In the second example, by adding a decimal specification of 2 to the format shows that fifty-six seconds is 93% of a minute.

See Also

Functions:
HMS Function in SAS Functions and CALL Routines: Reference
HOUR Function in SAS Functions and CALL Routines: Reference
MINUTE Function in SAS Functions and CALL Routines: Reference
SECOND Function in SAS Functions and CALL Routines: Reference
TIME Function in SAS Functions and CALL Routines: Reference
Informats: