Hi Chad, Many thanks. Yes, it worked for Excel 2003. /*When you import several sheets from a Excel 2003 workbook, I found below macro code works….*/ %macro name1 (one,two); PROC IMPORT OUT=work.&one DATAFILE="\\xxxx-xx-sas01\abc\myfiles\testing.xls" DBMS=xls REPLACE; GETNAMES=YES; SHEET="&two"; /*SHEET= option is acceptable */ RUN; %mend name1; %name1 (file1,Sheet1); %name1 (file2,Sheet2); %name1 (file3,Sheet3); But for Excel 2010, the macro I have shown below did not work. I do not know why. But when I imported one sheet at a time (without macronizing) then it worked. So, no problem I can import Excel 2010 sheets one at a time. /*IMPORT EXCEL 2010*/ /*BELOW MACRO CODE DID NOT WORK????*/ /*When you import several sheets from a Excel 2010 workbook, I found below macro code DID NOT WORK….*/ /*But worse comes to worse you can import 3 sheets one by one, one at a time without macronizing*/ %macro name2 (three,four); PROC IMPORT OUT=WORK.&three DATAFILE="\\xxxx-v7-sas01\xyz\mydata\testing.xlsx" DBMS=EXCELCS REPLACE; /* GETNAMES=YES;*/ /*You cannot use GETNAMES=YES; in this code*/ SHEET="&four"; /*SHEET= option is acceptable */ RUN; %mend name2; %name2 (file4,Sheet1); %name2 (file5,Sheet2); %name2 (file6,Sheet3); Thanks everybody for all these helps! Mirisage
... View more