The SAS Output Delivery System and reporting techniques

left outer join in Proc SQL

Accepted Solution Solved
Reply
Contributor
Posts: 62
Accepted Solution

left outer join in Proc SQL

I was wondering... I can remember some SAS statements can't be used in a Proc SQL session. Like "left outer join". After creating this code, the "left" (see below in red) is not coloured blue like the remaining part of the formula "... outer join". I thought this was one of the statements that did not work (since left has another function in SAS). But the code does work. Can anyone confirm that a "left outer join" just works within a proc SQL step? Thanks in advance!

proc sql;

create table dir.deel2 as

select *

  from dir.deel1 t1

  left outer join nl_xxx.yyy t2 on

  t1.accnr = t2.accbusid

  ;

quit;


Accepted Solutions
Solution
‎03-14-2013 09:04 AM
Super Contributor
Posts: 578

Re: left outer join in Proc SQL

I can confirm the use of left outer join.  You can also test sql code by adding the noexec option to the proc sql statement. 

View solution in original post


All Replies
Super User
Posts: 5,441

Re: left outer join in Proc SQL

Do I get you right: do you wonder if your program that does work, works?:smileyconfused:

SAS(R) 9.3 SQL Procedure User's Guide

Data never sleeps
Contributor
Posts: 62

Re: left outer join in Proc SQL

Partly ;-)

Since I've learned that you can't use certain SAS statements in a PROC SQL session (and I remember one of them was LEFT join, because LEFT is already reserved for the SAS base language), I was wondering if it will work correctly. It seems to work, but then again, why does "LEFT" not turn blue in the "left outer join" statement?

Super User
Posts: 5,441

Re: left outer join in Proc SQL

What will work and not work, is revealed by executing the program. The color scheming can't possibly reflect any aspect of SAS language. Just look how macros are color-coded...

Data never sleeps
Contributor
Posts: 62

Re: left outer join in Proc SQL

But there must be some program rules i guess...? In the SAS course I followed, this was one of the topics (SAS statements used in Proc SQL). Otherwise SAS would be one big trial and error game?

Super User
Posts: 5,441

Re: left outer join in Proc SQL

SAS Documentation...?

Data never sleeps
Contributor
Posts: 62

Re: left outer join in Proc SQL

Got them all (followed all base courses --> knowledge (as reffered to above) + sheets), books for certified base programmer (passed), now going for the advanced level (also all books in house). But round about 20k of pages... Thought it would be a good idea to post the question here, since this is a forum for / with SAS experts. Saves me some time.

Solution
‎03-14-2013 09:04 AM
Super Contributor
Posts: 578

Re: left outer join in Proc SQL

I can confirm the use of left outer join.  You can also test sql code by adding the noexec option to the proc sql statement. 

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 7 replies
  • 1084 views
  • 2 likes
  • 3 in conversation