BookmarkSubscribeRSS Feed
K23
Calcite | Level 5 K23
Calcite | Level 5

 What is the easiest way to import multiple sheets into SAS ?

2 REPLIES 2
ChrisHemedinger
Community Manager

If you have SAS 9.4M2 or later, LIBNAME XLSX is quick and easy.

 

Using LIBNAME XLSX to read and write Excel files

 

This assumes that your Excel data is well-formed: column headers in Row 1, contiguous data in each sheet.


Chris

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Fold them up and insert them into the floppy bay?  Seriously though, I am presuming your using Windows, Base SAS?  The quickest method would be to use libname excel, this creates a libname where you can see each sheet in the file.  However bear in mind that SAS != Excel.  There is a lot in Excel that SAS will not like, and Excel is not a structured file.  You will hit a lot of problems.  The question should be raised, why is Excel holding your data when it is neither a database or a proper data transfer format?  Even exporting to CSV would be far better.  

 

As for your question, without knowledge of what is on each sheet, its difficult to say.  You could save to CSV each sheet, write a datastep + infile import procedure.  You could try proc import, changing the sheet-name option each time, though that is a "guessing" procedure, so no guarentees what you will get out is what you want etc. What code have you got now?

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 646 views
  • 0 likes
  • 3 in conversation