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 (November 2000, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 16 Nov 2000 17:12:36 +1100
Reply-To:   "short, chris" <cshort@ABARE.GOV.AU>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "short, chris" <cshort@ABARE.GOV.AU>
Organization:   Australian Commonwealth Department of Agriculture, Fisheries and Forests http://www.daff.gov.au/
Subject:   string to time format

Are there any suggestions for reading a time string to a SAS dateTime value:

I have a string variable with values like:

"1999/05/01 04:05"

to convert it to a dateTime I do the following:

dtemp = substr (tradper,1,10); tradeDate = input (dtemp, yymmdd10.); ttemp = substr (tradper,12,6); tradeTime = input (ttemp, time5.);

bidDateTime = tradeDate * (60*60*24) + tradeTime;

I was wondering if this could be done with an (custom?) informat.

The only informat that came close was DATETIMEw. - but this is for ddmmyyyy hh:mm:ss format whereas I have yyyymmdd hh:mm:ss format.

Any suggestions would be appreciated - (coz this operation is done millions of times).

Perhaps I should just stick with what works :-)

Cheers, Christopher

---------------------------------------------------------------------------- Christopher Short Senior Economist Australian Bureau of Agricultural and Resource Economics

email: cshort@abare.gov.au ph: +61 2 6272 2083 fax: +61 2 6272 2328


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