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 (May 2006, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 2 May 2006 12:53:47 -0700
Reply-To:     "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Subject:      Re: handling inconsistent dates and time
Comments: To: Ya Huang <ya.huang@AMYLIN.COM>,
          "Nordlund, Dan (DSHS)" <NordlDJ@DSHS.WA.GOV>
Content-Type: text/plain; charset="us-ascii"

Interesting indeed. The hhmmss6 informat seems to be a pseudonym for the XML informat ND8601TM. Nice find Dan!

See http://support.sas.com/documentation/onlinedoc/91pdf/sasdoc_913/base_xml ug_8370.pdf

data test; input tran_date datetime18. auth_time $7.;

format tran_date tran_date1 tran_date2 datetime18.;

tran_date1=sum(tran_date,input(auth_time,hhmmss6.)); tran_date2=sum(tran_date,input(auth_time,ND8601TM.));

datalines; 02may2006:00:00:00 090909 02may2006:00:00:00 121212 run;

Paul Choate DDS Data Extraction (916) 654-2160

> -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Ya > Huang > Sent: Tuesday, May 02, 2006 12:31 PM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Re: handling inconsistent dates and time > > Interesting! I checked v9 online doc, the only informat start with 'h' > is hex. Is this another hidden treasure :-) ? > > On Tue, 2 May 2006 12:17:37 -0700, Nordlund, Dan (DSHS) > <NordlDJ@DSHS.WA.GOV> wrote: > > >> -----Original Message----- > >> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of > >> Rickards, Clinton (GE Consumer Finance) > >> Sent: Tuesday, May 02, 2006 12:04 PM > >> To: SAS-L@LISTSERV.UGA.EDU > >> Subject: handling inconsistent dates and time > >> > >> All, > >> > >> We are reading an Oracle DB that has a transaction date and an > >> authorization time. Tran_date is a datetime (although the time portion > is > >> always the equivalent of 00:00:00) and auth_time is a character field > in > >> hhmmss format. We need to combine them into a single datetime field. > >> > >> A search of the archives and documentation shows that there aren't any > >> informats to handle times of this format. Here is what we have thus > far. > >> It just strikes me as needlessly kludgy. Any better suggestions? > > > >Actually, yes there is. Try something like this: > > > >data _null_; > > attrib tran_date informat=datetime.; > > attrib auth_time informat=hhmmss6.; > > input tran_date > > auth_time ; > > my_date_time = TRAN_DATE+AUTH_TIME; > > put tran_date=datetime. auth_time= my_date_time=datetime.; > >datalines; > >02may2006:00:00:00 090909 > >02may2006:00:00:00 121212 > >; > >run; > > > >> > >> data _null_; > >> attrib tran_date informat=datetime.; > >> attrib auth_time informat=$6.; > >> input tran_date > >> auth_time ; > >> my_date_time = dhms(datepart(TRAN_DATE), > >> int(input(AUTH_TIME,best.)/10000), > >> Int(mod(input(AUTH_TIME,best.),10000)/100), > >> mod(input(AUTH_TIME,best.),100) ); > >> put tran_date=datetime. auth_time= my_date_time=datetime.; > >> datalines; > >> 02may2006:00:00:00 090909 > >> 02may2006:00:00:00 121212 > >> run; > >> > >> Thanks, > >> > >> Clint Rickards > >> Dual Card Fraud Strategy Manager > >> GE Consumer Finance > >> Shelton, CT > >> (Internal) 8*370-6156 > >> (External) (203) 944-6156 > > > >Hope this helps, > > > >Dan > > > >Daniel J. Nordlund > >Research and Data Analysis > >Washington State Department of Social and Health Services > >Olympia, WA 98504-5204


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