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?


 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 882 views
  • 1 like
  • 3 in conversation