LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (November 2010, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 8 Nov 2010 11:34:49 -0800
Reply-To:     "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Subject:      Re: Time > 24:00 is OK in SAS?
In-Reply-To:  <A8625BEB312CB2469E61B5E17F59B949580D5A59@EX-CMS01.westat.com>
Content-Type: text/plain; charset=utf-8

The anydtdtm format will work with that datetime. The OP's original example used the colon (:) modifier which caused it to read only up to the blank, so only the date was read. However, the point of the original request was that if the time was greater than (or equal to) 24:00:00 that it should be flagged as an error. He didn't want it to roll over to the next day.

Dan

Daniel J. Nordlund Washington State Department of Social and Health Services Planning, Performance, and Accountability Research and Data Analysis Division Olympia, WA 98504-5204

> -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of > Randy Herbison > Sent: Monday, November 08, 2010 11:16 AM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Re: Time > 24:00 is OK in SAS? > > I don't see the format of your datetime value among those supported by > the ANYDTDTM informat. Try the YMDDTTM informat and you'll see that it > increments the date value: > > 130 data _null_; > 131 dt=input('2010-08-18 30:00:00',YMDDTTM.); > 132 put dt datetime.; > 133 run; > > 19AUG10:06:00:00 > > > > -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of > Dave > Sent: Monday, November 08, 2010 1:34 PM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Time > 24:00 is OK in SAS? > > 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