BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Shrutibhatnagar
Obsidian | Level 7

hello i want to import multiple xls sheets to sas . please guide how to do it ?

1 ACCEPTED SOLUTION

Accepted Solutions
andreas_lds
Jade | Level 19
Google will reveal how to do this. Using libname-statement and proc copy is one way. Writing a proc import for each sheet is another way. Best thing you could do: export all sheets to CSV and use a data-step to read each. This is imho the only.way to get a reliable importing-process.

View solution in original post

2 REPLIES 2
andreas_lds
Jade | Level 19
Google will reveal how to do this. Using libname-statement and proc copy is one way. Writing a proc import for each sheet is another way. Best thing you could do: export all sheets to CSV and use a data-step to read each. This is imho the only.way to get a reliable importing-process.
RW9
Diamond | Level 26 RW9
Diamond | Level 26

I strongly advise you, if you have to use Excel at all, to move that data into a .xlsx file.  .xls is the very old binary file format MS used to use back in 2000 and before.  It shouldn't be used nowadays.  Technology has moved on a lot since then, and assuming your SAS version is 9.3 or later you can simplify your process if you xlsx to:

libname tmp xlsx "c:/path/to/file/yourfile.xlsx";

proc copy in=tmp out=work;
run;

libname tmp clear;

You can see the engine in action:
https://blogs.sas.com/content/sasdummy/2015/05/20/using-libname-xlsx-to-read-and-write-excel-files/

 

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore Now →
Develop Code with SAS Studio

Get started using SAS Studio to write, run and debug your SAS programs.

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
  • 2 replies
  • 2100 views
  • 3 likes
  • 3 in conversation