TODw.d Format

Writes SAS time values and the time portion of SAS datetime values in the form hh:mm:ss.ss.

Category: Date and Time
Alignment: Right
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written using this format might differ slightly from previous releases. For more information, see DECIMALCONV= System Option in SAS System Options: Reference.

Syntax

TODw.d

Syntax Description

w

specifies the width of the output field.

Default 8
Range 2–20
Tip SAS writes a zero for a zero hour if the specified width is sufficient. For example, the times 02:30 or 00:30 have a zero in the hour digits.

d

specifies the number of digits to the right of the decimal point in the seconds value. This argument is optional.

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

Details

The TODw.d format writes SAS time and datetime values in the form hh:mm:ss.ss:
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 TODw.d format writes a leading zero for a single-hour digit. The TIMEw.d format and the HHMMw.d format write a leading blank for a single-hour digit.

Examples

Example 1

In this example, the SAS datetime value 1661437223 corresponds to August 24, 2012 at 2:20:23 p.m.
SAS Statement
Result
----+----1
begin = '1:30't;
put begin tod5.;
 
01:30
begin = 1661437223;
put begin tod9.;
 
14:20:23

Example 2

In this example, the SAS time value 32083 corresponds to 8:54:43 a.m.
SAS Statement
Result
----+----1
begin = 32083;
put begin tod9.;
 
08:54:43

See Also

Functions:
TIMEPART Function in SAS Functions and CALL Routines: Reference
Informats: