HHMMSSw. Informat

Reads hours, minutes, and seconds in the form hh:mm:ss or hhmmss.

Category: Date and Time

Syntax

HHMMSSw.

Syntax Description

w

specifies the width of the input field.

Default 8
Range 1–20

Details

The HHMMSSw. informat reads SAS time values in one of the following forms:
  • hh:mm:ss
  • hhmmss
hh
is an integer that represents the number of hours.
:
represents a special character that separates hours, minutes, and seconds.
mm
is an integer that represents the number of minutes.
ss
is an integer that represents the number of seconds. Fractional seconds are ignored.
If the input data is six digits, SAS reads the data from left to right as hours, minutes, and seconds. For data that is less than six digits, SAS follows these rules:
  • If the number has an odd number of digits, SAS pads a zero to the left of the first digit. Then SAS pads after the last digit to the right with zeros until there are six digits.
  • If the number has an even number of digits, SAS pads zeros to the right of the last digit until there are six digits.
The first two digits are read as hours. Digits three and four are read as minutes. Digits five and six are read as seconds.
1 is the same as 010000 or 1:00:00.
02 is the same as 020000 or 2:00:00.
124 is the same as 0124000 or 1:24:00.
1435 is the same as 143500 or 14:35:00.
20345 is the same as 020345 or 2:03:45.
165532 is the same as 16:55:32.
When there are more than six digits, SAS reads the last two digits from the right as seconds. SAS reads the third and forth digits from the right as minutes. SAS reads the remaining digits to the left of the minutes as hours.
2358444 is the same as 235:84:44.
12545533 is the same as 1254:55:33.
If the input data has only one colon (for example, 17:35), SAS reads the two digits before the colon as hours. SAS reads the two digits after the colon as seconds. The number of seconds is 0.
If a colon is omitted between minutes and seconds, as in 12:3400, SAS reads the 3400 as 3400 minutes. 3400 minutes adds 56 hours and 40 minutes to the 12 hours, resulting in 68:40:00.

Example

input tm hhmmss.;
Data Line
Result
Formatted with TIMEw.
23
82800
23:00:00
12:45:44
45344
12:45:44
2358444
851084
236:24:44
17:35
63300
17:35:00
12:3400
247200
68:40:00

See Also

Informats: