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

Hi! I have a question about SQL joins using (+)

 

If I run a query using a connection to Oracle...

 

PROC SQL;

   CONNECT TO ORACLE (USER='xxxxx' PASSWORD=xxxx PATH etc);

   CREATE TABLE QUERY2 AS

   SELECT * FROM CONNECTION TO ORACLE

   (SELECT F1,F2,F3 FROM XXX WHERE A=B  AND C=D(+))

 

it works fine

but when I use a LIBNAME to set up the connection and just use a PROC SQL;

it errors on the (+)

 

DO I have to do the LEFT OUTER JOIN? (Hope not.. the actual query is enormous lol)

 

Thanks!!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

(+) is not valid SAS syntax, so yes, you need to rewrite the query in SAS SQL not Oracle SQL.

View solution in original post

7 REPLIES 7
Reeza
Super User

(+) is not valid SAS syntax, so yes, you need to rewrite the query in SAS SQL not Oracle SQL.

StaticFX
Obsidian | Level 7

well **bleep** lol. Not sure I can convert this query to left joins easily 🙂 Thanks!!!

Tom
Super User Tom
Super User

I am not sure I understand the question.  Are you asking if you can ORACLE specific SQL enhancements in SAS PROC SQL code?

If so then the answer is no.

PROC SQL uses ANSI SQL 92 standard syntax, plus some SAS specific enhancements.

kiranv_
Rhodochrosite | Level 12

yes it changes to left join

Tom
Super User Tom
Super User

Why not just leave the query in ORACLE code?

libname mydata oracle ..... ;
proc sql ;
connect using mydata;
create table want as select * from connection to mydata
( ... oracle query ...)
;
quit;
StaticFX
Obsidian | Level 7

Hi Tom i cant get this to work?

 

LIBNAME CAT ORACLE SCHEMA=CAT USER='xxxxxxx' PASSWORD='xxxxxx' PATH='@xxxx';

 

PROC SQL;

CONNECT USING CAT;  <<< Error  (connect in red)

 

wait... SAS EG flags that as RED/error but it works... cool 🙂

Tom
Super User Tom
Super User

The EDITOR is not SAS.

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1769 views
  • 3 likes
  • 4 in conversation