Hello all,
Can we say that match merge is like inner join in sql?
Please advise me.
Regards,
blue blue
Yes, it is "like" inner join.
No, it is not identical to inner join.
Hello Paige Miller,
You would say: "Yes, it is "like" inner join."
Doesn't it pull when the matches exist on left and right table?
then
You would say: "No, it is not identical to inner join."
Can you please elaborate it?
Regards,
Blue blue
@GN0001 wrote:
Hello Paige Miller,
You would say: "Yes, it is "like" inner join."
Doesn't it pull when the matches exist on left and right table?
then
You would say: "No, it is not identical to inner join."
I think you need to ask more specific and detailed questions. In my mind, on some criteria, merge is indeed "like" an inner join. On other criteria, merge is not "like" an inner join.
People have given examples of differences. There are probably other differences as well.
Here's a way to test this:
Make two data sets with the same named variables with the first variable all having the same value. Then do a match merge and an inner join on the two. Look at the results.
Similar- maybe under specific conditions. Depend on how loose your criteria is for setting likeness.
Data set1; input x y; datalines; 1 1 1 2 1 3 1 4 ; data set2; input x y; datalines; 1 11 1 22 1 33 ;
Hello,
This is what I have, I can't understand what happens and how to control it.
Thanks,
blue blue
Data set1; Input x y; dataline; 1 1 1 2 1 3 1 4 ; Data set2; Input x z; dataline; 1 11 1 22 1 33 ; data combined; Merge set2 set1; Run;
@GN0001 wrote:
Hello,
This is what I have, I can't understand what happens and how to control it.
Thanks,
blue blue
Data set1; Input x y; dataline; 1 1 1 2 1 3 1 4 ; Data set2; Input x z; dataline; 1 11 1 22 1 33 ; data combined; Merge set2 set1; Run;
You have neither a BY statement nor a Subsetting IF, so this ain't a match merge, you just put both datasets side-by-side.
Since you also have repeats of the common variable x in both datasets, you can't replicate the behavior of SQL (you have a many-to-many join).
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.