Date: Thu, 15 Oct 2009 13:47:46 -0700
Reply-To: "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Subject: Re: Reading Excel datetime variable into SAS
Content-Type: text/plain; charset="us-ascii"
One approach is to add the following
expression contained in the sample
datastep below into your datastep.
DateStringFromExcel = '08/01/2008 17:18';
SASDateTime = input(substr(DateStringFromExcel,1,10),mmddyy10.)
format SASDateTime datetime19.;
Hope this is helpful.
Investment Business Intelligence
Investment Management & Research
Global Leaders in Multi-Manager Investing
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Sent: Thursday, October 15, 2009 1:18 PM
Subject: Reading Excel datetime variable into SAS
I would like to read Excel file with ("mydatetime") variable (cell
General in Excel)
I tried the following codes to read the variable ("mydatetime") into
All other variables in Excel file were imported into SAS except for the
I would like to use this ("mydatetime") variable including the time
to calculate time differences and be able to covert it to SAS datetime
I also would like to know once this Excel variable ("mydatetime") is
datetime17. in SAS, can it be changed to datetime19. so that I can
time differences with other datetime19. variables. in SAS?
("mydatetime") variable in Excel (General cell format) looks like:
I would like this variable ("mydatetime") to be (Number 8 Datetime17.)
LibName xlsLib ".\Demo.xls"
Data sheet1 ;
Format mydatetime datetime17. ;
Set xlsLib."sheet1$"n (dbSasType=( mydatetime=dateTime )) ;
LibName xlsLib clear ;