1) The first one can be done in a excel vba.
2) The second one can be done by using libname engine. BTW you don't really need to know the tab/sheet names. Here is an example.
libname S EXCEL 'c:\temp\book1.xlsx';
proc sql noprint;
select catt(trim(libname),'.',quote(trim(memname)),'n') into: namelist seperated by ' '
from dictionary.tables
where libname in ('S');
quit;
%put &namelist;
data all;
set &namelist;
run;
proc print;run;
********************log*************;
89 libname S EXCEL 'c:\temp\book1.xlsx';
NOTE: Libref S was successfully assigned as follows:
Engine: EXCEL
Physical Name: c:\temp\book1.xlsx
290
291 proc sql noprint;
292 select catt(trim(libname),'.',quote(trim(memname)),'n') into: namelist separated by ' '
293 from dictionary.tables
294 where libname in ('S');
295 quit;
NOTE: PROCEDURE SQL used (Total process time):
real time 0.00 seconds
cpu time 0.01 seconds
296
297 %put &namelist;
S."a$"n S."e$"n S."f$"n
298
299 data all;
300 set &namelist;
301 run;
NOTE: There were 1 observations read from the data set S.'a$'n.
NOTE: There were 1 observations read from the data set S.'e$'n.
NOTE: There were 1 observations read from the data set S.'f$'n.
NOTE: The data set WORK.ALL has 3 observations and 3 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
302
303 proc print;run;
NOTE: There were 3 observations read from the data set WORK.ALL.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds




雷达卡





京公网安备 11010802022788号







