Sample 43569: CALL IS8601_CONVERT writes a time value with number of years, months, days, hours, minutes, and seconds
When a time value is represented in hours:minutes:seconds and the number of hours exceeds one day, it is often helpful to see the value represented in units larger than hours.
The CALL IS8601_CONVERT routine converts an ISO 8601 interval to datetime and duration values, or converts datetime and duration values to an ISO 8601 interval.
The routine is used in this example to convert the time value to a duration that is stored in a new variable called DUR. That value is formatted with the $N8601Ew. format.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
The time value 171:59:00 represents 171 hours and 59 minutes. The desired output is an extended duration format that shows the range of time from years to seconds.
data a;
x='171:59:00';
time=input(x,time13.);
length dur $16;
call is8601_convert('du','du',time,dur);
fmted=put(dur,$n8601e.);
run;
proc print;
run;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
Ob s x time dur fmted
1 171:59:00 619140 0000007035900000 P0Y0M7DT3H59M0.0S
Type: | Sample |
Topic: | SAS Reference ==> CALL routines
|
Date Modified: | 2011-06-22 13:23:18 |
Date Created: | 2011-06-21 11:56:23 |
Operating System and Release Information
SAS System | Base SAS | z/OS | 9.2 TS1M0 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.2 TS1M0 | |
Microsoft Windows XP 64-bit Edition | 9.2 TS1M0 | |
Microsoft® Windows® for x64 | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Standard Edition | 9.2 TS1M0 | |
Microsoft Windows XP Professional | 9.2 TS1M0 | |
Windows Vista | 9.2 TS1M0 | |
Windows Vista for x64 | 9.2 TS1M0 | |
64-bit Enabled AIX | 9.2 TS1M0 | |
64-bit Enabled HP-UX | 9.2 TS1M0 | |
64-bit Enabled Solaris | 9.2 TS1M0 | |
HP-UX IPF | 9.2 TS1M0 | |
Linux | 9.2 TS1M0 | |
Linux for x64 | 9.2 TS1M0 | |
OpenVMS on HP Integrity | 9.2 TS1M0 | |
Solaris for x64 | 9.2 TS1M0 | |