Hi Folks,
I have a couple of questions with respect to the following code:
data class1(drop=in2) class2 (drop=in1);
set sashelp.class (keep=name) ;
in1 = "left";
in2 = "right";
run;
PROC SQL;
create table work.join_syntax as
select coalesce(cl1.name , cl2.name) as name, in1, in2
from work.class1 as cl1 inner join work.class2 as cl2
on cl1.name = cl2.name
;
create table work.where_syntax as
select coalesce(cl1.name , cl2.name) as name, in1, in2
from work.class1 as cl1 , work.class2 as cl2
where cl1.name = cl2.name
;
quit;
The result table seems to be identical in terms of observations.
Does this also hold, when one or both of the tables have duplicat key values?
Also, with regards to the sort order and performance, respectivley: is it advantageous to use one over the other?
A similar question was asked with regards to EG code generation back in 2011:
https://communities.sas.com/t5/SAS-Enterprise-Guide/Join-Vs-Where/td-p/28293
Cheers,
FK21
Semantically, the codes do the same and will produce the same result; multiple observations for a key value will also result in the same cartesian products.
If there is a performance difference is best determined through tests with sufficiently large datasets.
You can use the _METHOD and _TREE options of the PROC SQL statement to see how the query is handled internally.
Semantically, the codes do the same and will produce the same result; multiple observations for a key value will also result in the same cartesian products.
If there is a performance difference is best determined through tests with sufficiently large datasets.
You can use the _METHOD and _TREE options of the PROC SQL statement to see how the query is handled internally.
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
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.