From: hewei2004 on
Hi,

If I have two files like this:

Left.csv:
ID Value1
1 a
1 b

Right.csv
ID Value2
1 c
1 d

Note the ID is duplicate. I want to merge by ID (most other
observations that not duplicate like this pathological example) but
how do I merge the two files so that every possible combination of
values are present in the merged file

Desired output:
Merge.csv
ID Value1 Value2
1 a c
1 a d
1 b c
1 b d
From: Tom Abernathy on
Use SQL to get a FULL JOIN.
proc sql;
create table new as
select a.*,b.*
from left a full join right b
on a.id = b.id
;
quit;

On Mar 21, 6:51 pm, hewei2004 <hewei2...(a)gmail.com> wrote:
> Hi,
>
> If I have two files like this:
>
> Left.csv:
> ID  Value1
> 1    a
> 1    b
>
> Right.csv
> ID  Value2
> 1   c
> 1   d
>
> Note the ID is duplicate. I want to merge by ID (most other
> observations that not duplicate like this pathological example) but
> how do I merge the two files so that every possible combination of
> values are present in the merged file
>
> Desired output:
> Merge.csv
> ID   Value1 Value2
> 1       a         c
> 1       a         d
> 1       b         c
> 1       b         d