Date: Wed, 2 Jun 1999 08:58:48 -0400
Reply-To: gary.mcquown@US.PWCGLOBAL.COM
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Gary McQuown <gary.mcquown@US.PWCGLOBAL.COM>
Subject: Re: Importing spreadsheets/workbooks from excel into SAS
Content-type: text/plain; charset=us-ascii
"Simple" is such a relative term. The following code is about as simple as
it gets while
making sure the data is read correctly. Choosing the correct options and
informats is
very important. You can determine the correct DDE triplet by opening SAS,
opening
Excel, copying the area in question in Excel and then choosing "options"
and "DDE
Triplet" from the SAS menu. The correct triplet will appear in the box.
For more information, check out the following site for more examples.
http://www.stanford.edu/class/gsb/excel2sas.html
/* Snip of Code */
/* Worksheet name: Courier PU Schedule
Workbook name: Sargtemp.xls
*/
/* opens Excel workbook */
x "c:\progra~1\micros~3\office\excel.exe
n:\rms\reps\reference\sartemp.xls";
/* SAS waits until Excel is open */
data _null_;x=sleep(3);run;
/*Opens sheet 3, Courier PU Schedule*/
filename in3 dde 'excel|Courier PU Schedule!R4C1:R53C4' ;
/* Use informats and correct options to read data */
data ref3 ;
infile in3 dlm='09'x notab dsd missover;
informat
kit $char3. /* kit */
weekday $char10. /* day of week */
puptime time8. /* couier pick up time */
;
input
kit $
weekday $
puptime
;
run;
Gary McQuown
ASG Contractor @
PriceWaterhouseCooper
Peter Baade <Peter_Baade@HEALTH.QLD.GOV.AU> on 06/01/99 11:23:59 PM
Please respond to Peter Baade <Peter_Baade@HEALTH.QLD.GOV.AU>
To: SAS-L@UGA.CC.UGA.EDU
cc:
Subject: Importing spreadsheets/workbooks from excel into SAS
Is there a "simple" way of importing data from an EXCEL97 workbook (with
multiple worksheets) in SAS (using SAS 6.12 on Windows95)?
I am trying to use the DDE syntax, but can only find very limited
documentation about its use.
Thanks
Peter.
----------------------------------------------------------------
The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from any
computer.