As a simplified example of what I am currently working on... Suppose I want to compare the performance of Roger Federer, Novak Djokovic, and Rafa Nadal in several Grand Slam tournaments last year. And suppose that I have a few datasets that contain each player's performance (such as 1st and 2nd serve win rate) and these datasets are named in the following manner: player_tournament_round (e.g Federer_USOpen_round1, Nadal_Wimbledon_round4) Suppose that I am only interested in the first 2 rounds of US Open, rounds 3-5 of Wimbledon, and first 4 rounds of Australian Open (assuming that the players attended all of these matches). So I already have a macro called 'input' that reads in these datasets and performs some tweaks, and it is specified as: %macro input(player, tour, round); In SAS, I invoked the macro as follows: %input(Federer, USOpen, round1); %input(Federer, USOpen, round2); %input(Federer, Wimbledon, round3); %input(Federer, Wimbledon, round4); %input(Federer, Wimbledon, round5); %input(Federer, AUOpen, round1); %input(Federer, AUOpen, round2); %input(Federer, AUOpen, round3); %input(Federer, AUOpen, round4); %input(Djokovic, USOpen, round1); %input(Djokovic, USOpen, round2); %input(Djokovic, Wimbledon, round3); %input(Djokovic, Wimbledon, round4); %input(Djokovic, Wimbledon, round5); %input(Djokovic, AUOpen, round1); %input(Djokovic, AUOpen, round2); %input(Djokovic, AUOpen, round3); %input(Djokovic, AUOpen, round4); %input(Nadal, USOpen, round1); %input(Nadal, USOpen, round2); %input(Nadal, Wimbledon, round3); %input(Nadal, Wimbledon, round4); %input(Nadal, Wimbledon, round5); %input(Nadal, AUOpen, round1); %input(Nadal, AUOpen, round2); %input(Nadal, AUOpen, round3); %input(Nadal, AUOpen, round4); -------------------------------------------------- As you can see, the macro invocation becomes quite redundant, because, for each player, I always need to enter rounds 1-2 for US Open, rounds 3-5 for Wimbeldon, and rounds 1-4 for AU Open. So my question is: how do I tell SAS to automatically do: rounds 1-2 if &tour. = USOpen rounds 3-5 if &tour. = Wimbledon rounds 1-4 if &tour. = AUOpen I have some thoughts, such as an array (do loop) or nested macro, but I have not been able to code it. Some help will be much appreciated!
... View more