*
;
/*
Here is a peice of code I used to read Excel 5.0 spreadsheets.  Excel must
be running at the time this SAS code is run.  The code must be run in
interactive PC SAS.

Batch won't work.

Once you have the OUTSAS dataset made, you can manipulate it
to convert columns to the proper names, data types, lengths, and formats.

Adam Hendricks
ICOS Corporation
Bothell, WA
adamhndrx@aol.com
*/

*****************************************;
*** Enter Number of Rows & Columns to ***;
*** Process on Excel Spreadsheets.   ***;
*****************************************;

*must be specified before run:;

 *%let cols = 16;
 *%let cols2 = %eval(&cols - 1);

%MACRO EXC2SAS(EXCF, R1, R2);
FILENAME &EXCF DDE "EXCEL|&EXCF..XLS!R&R1.C1:R&R2.C&COLS.";
DATA OUTSAS;
  LENGTH ID C1-C&cols2 $20;
  FORMAT ID C1-C&cols2 $20.;
  INFORMAT ID C1-C&cols2 $CHAR20.;
  INFILE &EXCF DLM='09'x NOTAB DSD TRUNCOVER MISSOVER;
  INPUT ID $

%DO I = 1 %TO &COLS2;
  C&I $
%END;
;
RUN;
%MEND;

* Read in 16 column, 25 row Excel spreadsheet, INEXCEL, from ;
* Excel 5.0 session.;

%let cols = 16;
%let cols2 = %eval(&cols - 1);
         *;
%EXC2SAS(INEXCEL, 1, 25);

*
;