- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
How can we use LEFT JOIN when we have more than 2 tables? PROC SQL equivalent code for the following merge statement code?l
Data abc;
merge a (in=X) b c;
by id;
if X;
run;
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@SASKiwi gives a good example of a 3 table join.
The example @Ujjawal gave though is for a match-merge which would generate (potentially) different results. HERE is a link to a SUGI 30 paper highlighting the differences (there are many other papers as well). There are reasons to use the different types of merge/joins depending on the need.
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
proc sql
create table abc as
select *
from a
left join b
on a.id = b.id
left join c
on a.id = c.id;
quit;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@SASKiwi gives a good example of a 3 table join.
The example @Ujjawal gave though is for a match-merge which would generate (potentially) different results. HERE is a link to a SUGI 30 paper highlighting the differences (there are many other papers as well). There are reasons to use the different types of merge/joins depending on the need.
Steve