Don't use timepart(), use original value, since they seem to be
SAS datatime var already. The difference of startts and endts is
in second. You can then choose whatever the format you need to
present the duration.
On Thu, 26 Jun 2008 13:01:28 -0400, Karen smith <ponwtr@HOTMAIL.COM> wrote:
>I am trying create a data element named DURATION by subtracting the End
>Time from the Start Time.
>START = TIMEPART(STARTTS);
>END = TIMEPART(ENDTS);
>DURATION = END - START;
>This works fine until the End Time is one date, & the Start Time is another
>date. Then DURATION ends up being an incorrect negative number.
>START Time END Time
>I have Googled for an answer, searched SAS and SAS-L. I have found a few
>hits. Can someone direct me to some SAS function, or better yet, an
>example on how to calculate DURATION.
>Thanks In Advance