SAS Enterprise Guide

Desktop productivity for business analysts and programmers
BookmarkSubscribeRSS Feed
cmcquain
Fluorite | Level 6

I am trying to use a subquery within a left join and I am getting this error.

 

ERROR: ORACLE prepare error: ORA-00905: missing keyword. SQL statement: select WDM_HSBSB_SUBSC.SBSB_ID as CARD_HLDR_ID_NUM,

WDM_HMEME_MEMBER.MEME_FIRST_NAME || ' ' || WDM_HMEME_MEMBER.MEME_LAST_NAME as PATIENT_NAME, WDM_HMEME_MEMBER.MEME_BIRTH_DT

 

Here is a sample of my code

 

left join

select

   max (HIDCD_SK) as max_HIDCD_SK,

       IDCD_DESC

from WDM_HIDCD_DIAG_CD

where max_HIDCD_SK = HIDCD_SK) as DIAG_DESC

on (WDM_DDIST_DIAG_SET.DDIST_IDCD_AD = DIAG_DESC.max_HIDCD_SK)

 

where

WDM_HSBSB_SUBSC.SBSB_ID in

('XXXXX') 

and WDM_DFNIN_FUNDING_INFO.DFNIN_CLAIM_TYPE <> 'R' /* R = pharmacy */

and WFT_FCDML_CL_LINE.FCDML_RPT_PAID_DT <> WFT_FCDML_CL_LINE.FCDML_PROCESS_DT

and WDM_HCLCL_CLAIM.HCLCL_AS_OF_TO_DT = '31-Dec-9999'

and WDM_DCDBC_CL_LINE_BCN_CODES.DCDCD_DENIAL_IND = 'N'

 

What am I doing wrong?

 

5 REPLIES 5
LinusH
Tourmaline | Level 20

Since you are not sharing the full code, I'm assuming your submitting this in a pass through block (...FROM CONNECTION TO...).

Everything within this block is totally agnostic for SAS, it's the responsibility for the target DBMS (Oracle). So reach out to your fellow Oracle users instead.

Data never sleeps
cmcquain
Fluorite | Level 6

You are correct I am using a pass through.  I will start searching oracle joins then.

 

Thank you

Reeza
Super User

where max_HIDCD_SK = HIDCD_SK) as DIAG_DESC

on (WDM_DDIST_DIAG_SET.DDIST_IDCD_AD = DIAG_DESC.max_HIDCD_SK)


That first line doesn't look correct, you usually don't alias on WHERE conditions?

SASKiwi
PROC Star

Where does your subquery end? I don't see any closing bracket.

cmcquain
Fluorite | Level 6

It's there.  I just didn't copy and paste it.

sas-innovate-white.png

Special offer for SAS Communities members

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.

 

View the full agenda.

Register now!

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 3800 views
  • 0 likes
  • 4 in conversation