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;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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