E8601LZw. Format

Writes time values as local time, appending the Coordinated Universal Time (UTC) offset for the local SAS session, using the ISO 8601 extended time notation hh:mm:ss+|–hh:mm.
Categories: Date and Time

ISO 8601

Alignment: left
Alias: IS8601LZ
Supports: ISO 8601 Element 5.3.1.1, complete representation

Syntax

E8601LZw.

Syntax Description

w
specifies the width of the output field.
Default:14
Range:9–20

Details

The E8601LZ format writes time values without making any adjustments, and appends the UTC time zone offset for the local SAS session by using one of the following ISO 8601 extended time notations:
  • hh:mm:ss+|–hh:mm
    Note: Use this form when w is large enough to support this time notation.
  • hh:mm:ssZ
    Note: Use this form when w is not large enough to support the +|– hh:mm time zone notation.
hh
is a two-digit hour (zero padded) between 00 and 23.
mm
is a two-digit minute (zero padded) between 00 and 59.
ss
is a two-digit second (zero padded) between 00 and 59.
+|–hh:mm
is an hour and minute signed offset from zero meridian time. Note that the offset must be +|–hh:mm (that is, + or – and five characters).
Use + for time zones east of the zero meridian, and use – for time zones west of the zero meridian. For example, +02:00 indicates a two-hour time difference to the east of the zero meridian, and –06:00 indicates a six-hour time difference to the west of the zero meridian.
Restriction: The shorter form +|–hh is not supported.
Z
indicates zero meridian (Greenwich, England) or +00:00 UTC time.
SAS writes the time value by using the form hh:mm.ffffff, and appends the time zone indicator +|–hh:mm based on the time zone offset from the zero meridian for the local SAS session, or Z. The Z time zone indicator is used for format lengths that are less than 14.
If the same time is written using both zone indicators, they indicate two different times based on the UTC. For example, if the local SAS session uses Eastern Standard Time in the U.S., and the time value is 45824, SAS would write 12:43:44–04:00 or 12:43:44Z. The time 12:43:44–04:00 is the time 16:43:44+00:00 at the zero meridian. The Z indicates that the time is the time at the zero meridian, or 12:43:44+00:00.
When SAS reads a UTC time by using the E8601TZ informat, and the adjusted time is greater than 24 hours or less than 00 hours, SAS adjusts the value so that the time is between 00:00:00 and 24:00:00. If the E8601LZ format attempts to format a time outside of this time range, the time is formatted with asterisks to indicate that the value is out of range.

Example

This PUT statement writes the time for the Eastern Standard Time zone:
put elz e8601lz.;
Value of elz
Result
46380
12:53:00-5:00