BookmarkSubscribeRSS Feed
GingerJJ
Obsidian | Level 7

Hello,

 

I used to use SAS EG to import excel with multiple sheets. It works very well. Here is my code:

 

libname AB excel 'X:\datafile.xls' ;
proc sql noprint ;
select cats( "AB.'", memname, "'n" ) into : xlfiles separated by ' '
from dictionary.members
where libname = 'AB'
order by memname ;
%put The workbook contains &sqlobs worksheets with data ;
quit ;
data together ;
set &xlfiles ;
run ;

 

However, when I tried to used it in my SAS Viya, it gives me this error:

ERROR: The EXCEL engine cannot be found.
ERROR: Error in the LIBNAME statement.
How can I import excel with multiple sheet into SAS Viya?
Thank you.



 

 

3 REPLIES 3
SASJedi
Ammonite | Level 13

The EXCEL engine is technology that works with Windows, but SAS Viya runs in Linux. The XLS file type stopped being the default for Excel in 2003 - that's some seriously old technology! Since then, the Excel default file type has been XLSX. If you can save the Excel file as in XLSX format, you can use the XLSX engine in your LIBNAME statement like this:

 

libname AB xlsx '~/datafile.xlsx' ;

Also, SAS Viya won't have access to Windows drives - you'll have to upload the XLSX file to a directory on Viya Linux environment. The above code assumes you loaded the file into your home directory.  After that, the rest of your code should work just fine. 

 

If this isn't possible, your system may have access to a SAS PC Files server. If so, you could use SAS PCFILES syntax for your LIBNAME statement, and that should work, too.

Check out my Jedi SAS Tricks for SAS Users
Ksharp
Super User

That means your sas don't have license of EXCEL engine. But you could try other engines: XLS XLSX:

libname AB xls 'X:\datafile.xls' ;
libname AB xlsx 'X:\datafile.xls' ;

 

proc copy in=AB out=work noclone;

run;

SASJedi
Ammonite | Level 13

Just to clarify, all flavors of SAS Viya installations include a SAS/ACCESS to PC File Formats. 

Check out my Jedi SAS Tricks for SAS Users

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 885 views
  • 5 likes
  • 3 in conversation