BookmarkSubscribeRSS Feed
Rohan_Garg4
Calcite | Level 5

What is the best way to import a .xls file with multiple sheets that you are interested in importing? Do you individually import each sheet or do a RANGE function?

2 REPLIES 2
kirstinpruitt
Calcite | Level 5

Hi - I am a fairly new SAS user myself, but it is my understanding that you would import each sheet and the RANGE function is utilized for subsetting data within a sheet. Maybe to avoid writing so much code, you could employ a macro to change the sheet names as many times as you desire. 

Reeza
Super User

LIBNAME + PROC COPY to read everything in quickly and at once.

 

I only use RANGE when I need to extract data that's in a weird format. This will copy all files from the Excel file to your work library in one shot. You can select specific sheets if you'd like.

 

libname myXL xlsx '/folders/myfolders/demo.xlsx';

proc copy in=myXL out=work;
run;

@Rohan_Garg4 wrote:

What is the best way to import a .xls file with multiple sheets that you are interested in importing? Do you individually import each sheet or do a RANGE function?


 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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
  • 2 replies
  • 955 views
  • 1 like
  • 3 in conversation