Open ManytoMany left.csv 

Open ManytoMany right.csv

ManytoMany left.csv preview

ManytoMany right.csv preview

*To import the data;

proc import datafile = 'C:/ManytoMany left.csv' out = l_data

dbms = csv replace;

getnames = yes;

run;

proc import datafile = 'C:/ManytoMany right.csv' out = r_data

dbms = csv replace;

getnames = yes;

run;

The data step does not produce the correct results for a many to many merge.

The SAS code will compile without producing an error.

* Refer to l_data as dataset a and r_data as dataset b;

* Select all variables from l_data and the Fruits variable from r_data;

proc sql;

create table sql_outer_left as

select a.*, b.fruits

from l_data a left join r_data b

on a.Key = b.Key

;

quit;

Example data

Functions referenced:

proc import

proc sql: join

More information:

data step: merge vs proc sql: join

--- The End ---