What is the source of the elapsed times?
Are you getting it from outside SAS? If it's from outside SAS (Excel for example), the representation can be different and a conversion is necessary. Again using Excel as an example, Excel bases everything off of Jan 1, 1900. SAS, on the other hand, bases everything off of Jan 1, 1960. Excel date-times will appear to be far in the future in SAS if not converted.
Inside SAS, normally one just subtracts the ending date-time value from the starting date-time value. I typically use the format TIME13.2 with elapsed times.
As an example:
%LET Start_Datetime = %SYSFUNC(INPUTN('07sep2018:23:00:00'dt, DATETIME18.));
%LET End_DateTime = %SYSFUNC(INPUTN('08sep2018:01:00:00'dt, DATETIME18.));
%PUT %SYSFUNC(COMPRESS(%SYSFUNC(PUTN(%SYSEVALF(&End_DateTime - &Start_DateTime), TIME13.2))));
Results in:
2:00:00.00
Indicating that 2 hours, 0 minutes, and 0 seconds have elapsed.
Jim
... View more