BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
anming
Pyrite | Level 9
proc sql;
create table inner_one As
select g.stu_id, score1, score3
from score_data_g as g inner join
score_data_ng as ng
on g.stu_id=ng.stu_id;
/* on score_data_g.stu_id = score_data_ng.stu_id; */
quit;

proc sql;
create table inner_one As
select g.stu_id, score1, score3
from score_data_g as g,
score_data_ng as ng
/* where g.stu_id=ng.stu_id; */
/* where score_data_g.stu_id = score_data_ng.stu_id; */
where g.stu_id = ng.stu_id;
quit;



 

In two codes above, the on clause in inner join can be replaced by the where clause. But it does not work for outer join
(left, right and full join). In both the where clause and the inner join, it seems that order of two datasets does
not make different.

Does this correct?

1 ACCEPTED SOLUTION
3 REPLIES 3
Reeza
Super User
Code blocks are for code, not your question.
You may want to define what you mean by "WORK" here, because the code will run and execute without errors. You may be able to replace your ON with WHERE but it may not be as simple as just changing ON to WHERE.
anming
Pyrite | Level 9

For an inner join of two data sets "on" clause is used and two data sets are listed with "inner join" but for 'where' two data sets are separated by a comma.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 476 views
  • 1 like
  • 3 in conversation