Date: Wed, 10 Feb 2010 21:40:06 -0500
Reply-To: msz03@albany.edu
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Mike Zdeb <msz03@ALBANY.EDU>
Subject: Re: import multiple tabs in 1 Excel file
Content-Type: text/plain;charset=iso-8859-1
hi ... here's a V9.2 solution (the INDSNAME option starts in V9.2 )...
* your Excel file;
libname x 'z:\mydata.xls';
* put the names of the sheets into a macro variable;
proc sql noprint;
select catt('x.',memname,'n') into :dsets separated by ' '
from dictionary.tables
where libname eq 'X';
quit;
* use the indsname option to grab the sheet name;
data all;
set &dsets indsname=dsn;
dset = scan(dsn,2,"'$");
run;
libname x clear;
--
Mike Zdeb
U@Albany School of Public Health
One University Place
Rensselaer, New York 12144-3456
P/518-402-6479 F/630-604-1475
> I have an Excel workbook, in which I have multiple worksheets, each of which
> is a daily log of several Job IDs and job volumes. The name of the worksheet
> is like a date, such as "MMDDYY", "MM-DD-YY". Can anyone tell me how to
> write a SAS Macro to read all those worksheets into a single SAS dataset and
> tag each line of data with the date it belongs to?
>
> Thank you in advance
>
> -Tina
>
|