So I am writing a macro that might have some keyword parameters. Here is an example of the action which I want to do. I want to take variables X and Y from dataset1 . But if there are some variables specified for the keyword parameters (e.g. vars=A B C), I want to take those variables too. How do I tell SAS to add these values %macro merge_dataset(vars=); proc sql; create table output as select distinct a.date, a.ID, b.date, b.ID, b.X,b.Y, /*here is where I want to add "b.A, b.B, b.C,"/* from dataset1 as a, dataset2 as b where a.date=b.date and a.ID=b.ID; quit; %mend; %merge_dataset(vars=A B C); One way to solve this is to put in a condition such as : If %vars. ne then do; .......;.end;
else do; ......;end; But this is too long.
... View more