your input parameter can be a list. then %scan them to retrieve each list element (sheet name), instead of calling your macro 4 times
@gerrabosco4034
3 жыл бұрын
Could you please explain? Is there also a way to then put the sheet names into a column? Thank you!
@kzu8976
3 жыл бұрын
@@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));
@wilddoge2737
4 жыл бұрын
Hi! Do you know a trick to import two or more SAS tables in a single excel sheet?
Пікірлер: 8