BookmarkSubscribeRSS Feed
deleted_user
Not applicable
hi,

select * from dim_account_type where (account_type,account_sub_type)
in (select account_type,account_sub_type from dim_account_type);

Thanks in adv
2 REPLIES 2
Doc_Duke
Rhodochrosite | Level 12
Oracle extended it's SQL beyond the ANSI Standard (every company does, just in different directions), so it's a difference that we are stuck with.

SAS has a section in the SQL reference about the differences between SAS SQL and ANSI SQL. I expect there is a similar document for Oracle SQL. Both support the complete ANSI standard (I think), but the extensions are useful, so you have to choose between portability and power.
RichardH_sas
SAS Employee
Try this......
proc sql;
select *
from dim_account
where account_type in
(select account_type
from dim_account_type)
AND
account_sub_type in
(select account_sub_type
from dim_account_type);
quit;

As Doc mentioned, the Oracle code features an enhancement to the ANSI standard... this particular one isn't supported by SAS so you'd have to code around it as above. PROC SQL only allows a subquery to return a maximum of one column. Another alternative would be a join with an in-line view:

proc sql;
select d1.*
from dim_account as d1,
(select distinct account_type, account_sub_type
from dim_account_type) as d2
where d1.account_type=d2.account_type
and d1.account_sub_type=d2.account_sub_type;
quit;

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 2 replies
  • 570 views
  • 0 likes
  • 3 in conversation