@@gerrabosco4034 I was talking about a simple loop.something like this : (pseudo code, for different files. for sheet names, you can change the proc import part ) %macro customizedimport(filelist); let num = 1; filename = %scan(filelist, num); proc sql; (create a table that will contain all input file names) create table filenames as ...... quit; %do %while(&filename ne ) 1. proc import datafile = filename out= out&num ...... (output imported excel dataset to out1, out2 etc.) 2. proc sql; ( append filename into the table "filenames"); num = %eval(num + 1); filename = %scan(filelist, num); %end; %mend then you can call it like this: %customizedimport( %str( filename1 filename2 filename3));
What a great video. Thank you, sir.
your input parameter can be a list. then %scan them to retrieve each list element (sheet name), instead of calling your macro 4 times
Could you please explain? Is there also a way to then put the sheet names into a column? Thank you!
@@gerrabosco4034 I was talking about a simple loop.something like this : (pseudo code, for different files. for sheet names, you can change the proc import part )
%macro customizedimport(filelist);
let num = 1;
filename = %scan(filelist, num);
proc sql; (create a table that will contain all input file names)
create table filenames as ......
quit;
%do %while(&filename ne )
1. proc import datafile = filename out= out&num ...... (output imported excel dataset to out1, out2 etc.)
2. proc sql; ( append filename into the table "filenames");
num = %eval(num + 1);
filename = %scan(filelist, num);
%end;
%mend
then you can call it like this:
%customizedimport( %str( filename1 filename2 filename3));
thank you so much!!! really helpful
You are most welcome. I am glad it was useful.
Hi!
Do you know a trick to import two or more SAS tables in a single excel sheet?
The problem is when you have 1000 sheets.