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?
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.
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?
April 27 – 30 | Gaylord Texan | Grapevine, Texas
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!
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.
Ready to level-up your skills? Choose your own adventure.