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 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of 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
  • 609 views
  • 1 like
  • 3 in conversation