<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: one query not working in SAS but working in oracle in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/one-query-not-working-in-SAS-but-working-in-oracle/m-p/19811#M3358</link>
    <description>Try this......&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  select *&lt;BR /&gt;
    from dim_account&lt;BR /&gt;
    where account_type in&lt;BR /&gt;
        (select account_type&lt;BR /&gt;
           from dim_account_type)&lt;BR /&gt;
      AND&lt;BR /&gt;
        account_sub_type in&lt;BR /&gt;
        (select account_sub_type&lt;BR /&gt;
           from dim_account_type);&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
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:&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  select d1.*&lt;BR /&gt;
    from dim_account as d1,&lt;BR /&gt;
        (select distinct account_type, account_sub_type&lt;BR /&gt;
           from dim_account_type) as d2&lt;BR /&gt;
    where d1.account_type=d2.account_type&lt;BR /&gt;
      and d1.account_sub_type=d2.account_sub_type;&lt;BR /&gt;
quit;</description>
    <pubDate>Thu, 16 Apr 2009 15:56:03 GMT</pubDate>
    <dc:creator>RichardH_sas</dc:creator>
    <dc:date>2009-04-16T15:56:03Z</dc:date>
    <item>
      <title>one query not working in SAS but working in oracle</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/one-query-not-working-in-SAS-but-working-in-oracle/m-p/19809#M3356</link>
      <description>hi,&lt;BR /&gt;
&lt;BR /&gt;
select * from dim_account_type where (account_type,account_sub_type) &lt;BR /&gt;
in (select account_type,account_sub_type from dim_account_type);&lt;BR /&gt;
&lt;BR /&gt;
Thanks in adv</description>
      <pubDate>Thu, 16 Apr 2009 13:29:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/one-query-not-working-in-SAS-but-working-in-oracle/m-p/19809#M3356</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-04-16T13:29:01Z</dc:date>
    </item>
    <item>
      <title>Re: one query not working in SAS but working in oracle</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/one-query-not-working-in-SAS-but-working-in-oracle/m-p/19810#M3357</link>
      <description>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.&lt;BR /&gt;
&lt;BR /&gt;
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.</description>
      <pubDate>Thu, 16 Apr 2009 13:55:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/one-query-not-working-in-SAS-but-working-in-oracle/m-p/19810#M3357</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2009-04-16T13:55:33Z</dc:date>
    </item>
    <item>
      <title>Re: one query not working in SAS but working in oracle</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/one-query-not-working-in-SAS-but-working-in-oracle/m-p/19811#M3358</link>
      <description>Try this......&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  select *&lt;BR /&gt;
    from dim_account&lt;BR /&gt;
    where account_type in&lt;BR /&gt;
        (select account_type&lt;BR /&gt;
           from dim_account_type)&lt;BR /&gt;
      AND&lt;BR /&gt;
        account_sub_type in&lt;BR /&gt;
        (select account_sub_type&lt;BR /&gt;
           from dim_account_type);&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
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:&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  select d1.*&lt;BR /&gt;
    from dim_account as d1,&lt;BR /&gt;
        (select distinct account_type, account_sub_type&lt;BR /&gt;
           from dim_account_type) as d2&lt;BR /&gt;
    where d1.account_type=d2.account_type&lt;BR /&gt;
      and d1.account_sub_type=d2.account_sub_type;&lt;BR /&gt;
quit;</description>
      <pubDate>Thu, 16 Apr 2009 15:56:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/one-query-not-working-in-SAS-but-working-in-oracle/m-p/19811#M3358</guid>
      <dc:creator>RichardH_sas</dc:creator>
      <dc:date>2009-04-16T15:56:03Z</dc:date>
    </item>
  </channel>
</rss>

