Desktop productivity for business analysts and programmers

one query not working in SAS but working in oracle

Reply
N/A
Posts: 0

one query not working in SAS but working in oracle

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
Trusted Advisor
Posts: 2,114

Re: one query not working in SAS but working in oracle

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.
SAS Employee
Posts: 149

Re: one query not working in SAS but working in oracle

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;
Ask a Question
Discussion stats
  • 2 replies
  • 98 views
  • 0 likes
  • 3 in conversation