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 or less, SAS reads the data from left to right as hours, minutes, and seconds. Any data less than six digits is padded to the right with zeros. 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 100000 or 10:00:00.
02 is the same as 020000 or 02:00:00.
124 is the same as 124000 or 12:40:00.
1435 is the same as 143500 or 14:35:00.
20345 is the same as 203450 or 20:34:50.
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. The third and forth digits from the right are read as minutes. The remaining digits to the left of the minutes are read 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), the two digits before the colon are read as hours. The two digits after the colon are read as seconds. The number of seconds is 0.
Note: If a colon is omitted between minutes and seconds, as in 12:3400, the 3400 is read as 3400 minutes. 3400 minutes adds 56 hours and 40 minutes to the 12 hours, resulting in 68:40:00. See the following example.

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: