For XLSX files you can just read the actual XML file that is inside the file to find the sheet names.
For example to find the sheets in the xlsx file named book1.xlsx in the directory c:\downloads I could run this program.
data worksheets;
infile "c:\downloads\book1.xlsx" zip member='xl/workbook.xml' recfm=n dsd dlm=' ';
sheet_number+1;
input @'<sheet name=' sheet_name :$32. @@;
run;
No idea how you would do it with XLS files (why do you still have XLS files anyway?).
If you have SAS/ACCESS then Libname xlsx engine will allow to read all sheets without checking sheet names. Refer to the documentation https://blogs.sas.com/content/sasdummy/2015/05/20/using-libname-xlsx-to-read-and-write-excel-files/
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.