Multiple to multiple merge cannot be done using SAS data step (actually it can be done, but the result will be unexpected), so normally, when dealing with multiple to multiple merge, we will use sql, please see the detailed code in below:
proc sql;
create table OutTable(drop=index1) as
select main.*, auxi.vara, auxi.varb
from main, auxi
where main.comb = auxi.comb and main.year = auxi.year and main.qtr = auxi.qtr
order by main.index1, auxi.index2;
quit;
Hi akalius,
This website will automatically reformat the input statement in data main step (input comayearqtrcomb varm;), so please see the full code in attachment.
proc sql;
create table OutTable(drop=index1) as
select main.*, auxi.vara, auxi.varb
from main, auxi
where main.comb = auxi.comb and main.year = auxi.year and main.qtr = auxi.qtr;
/* order by main.index1, auxi.index2; */
quit;