I found a way of achieving this a while back, so I am posting my solution here in case someone else encounters the same problem as I had in the future... As a said earlier, I already have a SAS macro called 'input' that reads in the datasets, but it gets quite redundant for each grand slam tournament (because I always only want the 1st two matches in US Open, 3rd-5th matches in Wimbledon, and 1st four matches in Australian Open). As such, I am creating a 2nd SAS macro that uses my 'input' macro as follows: %macro readin(player, tour);
%if &tour.=USOpen %then %do;
%input(player, tour, round1);
%input(player, tour, round2);
%end;
%else %if &tour.=Wimbledon %then %do;
%input(player, tour, round3);
%input(player, tour, round4);
%input(player, tour, round5);
%end;
%else %if &tour.=AUOpen %then %do;
%input(player, tour, round1);
%input(player, tour, round2);
%input(player, tour, round3);
%input(player, tour, round4); %end;
%else %do;
%put Undefined input for grand slam tournament;
abort cancel;
%end; %mend readin; As such, I can achieve what I want with 9 lines of code (instead of the previous 27 lines): %readin(Federer, USOpen);
%readin(Federer, Wimbledon);
%readin(Federer, AUOpen);
%readin(Djokovic, USOpen);
%readin(Djokovic, Wimbledon);
%readin(Djokovic, AUOpen);
%readin(Nadal, USOpen);
%readin(Nadal, Wimbledon);
%readin(Nadal, AUOpen); Here, the results from the macro 'readin' are the exact same as from the macro 'input', but 'readin' saves 18 lines of macro invocation, and reduces the potential of typing/copying and pasting errors... I've heard that nesting macros can be bad from a performance stand point, but in my case, I think it's well worth it. Hope this helps (:
... View more