BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Wouter
Obsidian | Level 7

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;

1 ACCEPTED SOLUTION

Accepted Solutions
DBailey
Lapis Lazuli | Level 10

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

7 REPLIES 7
LinusH
Tourmaline | Level 20

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
Wouter
Obsidian | Level 7

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?

LinusH
Tourmaline | Level 20

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
Wouter
Obsidian | Level 7

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?

LinusH
Tourmaline | Level 20

SAS Documentation...?

Data never sleeps
Wouter
Obsidian | Level 7

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.

DBailey
Lapis Lazuli | Level 10

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. 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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