LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (June 2008, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 26 Jun 2008 13:32:53 -0400
Reply-To:     Ya Huang <ya.huang@AMYLIN.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Ya Huang <ya.huang@AMYLIN.COM>
Subject:      Re: Calculating Duration
Comments: To: Karen smith <ponwtr@HOTMAIL.COM>

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:

>Hello All. > >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 >23JUN08:23:59:41.56 24JUN08:00:00:23.82 > >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

Back to: Top of message | Previous page | Main SAS-L page