Date: Thu, 1 Dec 2005 12:08:04 -0500
Reply-To: Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Subject: Re: Any New Date Time Informats that will handle this -
'10/16/2005 3:55:14 PM'
On Thu, 1 Dec 2005 11:47:10 -0500, Charles Patridge
<charles_s_patridge@PRODIGY.NET> wrote:
>Does anyone know of any new datetime informats in Version 9 that will
>handle this format of datetime input???
>
>'10/16/2005 3:55:14 PM' - where there is AM or PM at the end of a field
>
>Thanks,
>
>Just checking before I have to create my own conversion format.
>
>Charles Patridge
>chuck at fullcapture dot com
nearly! The ANYDTDTM. informat reads it, but ignores the PM. AM is assumed
always.
43 data a;
44 x=input('10/16/2005 3:55:14 AM' ,ANYDTDTM.);
45 y=input('10/16/2005 3:55:14 PM' ,ANYDTDTM.);
46 put x datetime22.;
47 put y datetime22.;
48 run;
16OCT2005:03:55:14
16OCT2005:03:55:14
Maybe you can get the trailing string with scan(xxx,-1," ") and add 12*60*60
if it is "PM"?
|