```Date: Mon, 8 Nov 2010 14:20:55 -0500 Reply-To: peterflomconsulting@mindspring.com Sender: "SAS(r) Discussion" From: Peter Flom Subject: Re: Time > 24:00 is OK in SAS? Comments: To: Dave Brewer In-Reply-To: <201011081904.oA8HQOWY027934@willow.cc.uga.edu> Content-Type: text/plain; charset="us-ascii" This seems like two questions: 1) Why did the data come in this way? And 2) Why does SAS allow it? As to 1). Could be data entry error. Or it could be that the time was recorded as hours after a certain time, and date added later. (E.g. if 30:00:00 means 30 hours after admission to hospital, and date of admission is a separate field, and they got combined by someone into one datetime variable when they ought to be two variables. As to 2) Data null suggested duration. There are also statistics. Suppose you have only a TIME and not a date. Then to take the average, you may easily want a value over 24. E.g. "What is the average bed time?" and you enter 22 2 23 20 1 that averages to something silly. (22 + 2 + 23 + 20 + 1)/5 = 13.6 or about 1:30 PM You need, e.g. hours past the previous midnight: (22 + 26 + 23 + 20 + 25)/5 = 23.2 or a little after 11PM Which is really just a reason you'd want duration when your input was time. Peter -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Dave Brewer Sent: Monday, November 08, 2010 2:05 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Time > 24:00 is OK in SAS? This is how the data came in...it is supposed to be a date-time when blood was taken, that's why I am concerned. Dave On Mon, 8 Nov 2010 13:02:14 -0600, Data _null_; wrote: >Duration? > >On Mon, Nov 8, 2010 at 12:33 PM, Dave wrote: >> Hi All, >> >> Can anyone explain to me why SAS doesn't flag a time > 24:00 as any error? >> >> data dave; >> input start_dt :ANYDTDTM.; >> format start_dt datetime.; >> cards; >> 2010-08-18 30:00:00 >> ; >> run; >> proc print; >> run; >> >> SAS tells me that an invalid date (ex, Nov 31) will be flagged, but they >> don't flag times > 24:00 as an error. How can you have more than 24 hours >> in a day? >> >> Because of this, I can't use the ANYDTDTM. as an INFORMAT. I must now >> interrogate the field and look at the time portion. >> >> Thoughts? >> Dave >> ```

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