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?
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.