<?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 SQL - ODBC - using &amp;quot;in&amp;quot; from a local dataset in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/SQL-ODBC-using-quot-in-quot-from-a-local-dataset/m-p/33329#M8065</link>
    <description>proc sql;&lt;BR /&gt;
connect to odbc(dsn=DSNname uid=user_id password=XXXXXXX);&lt;BR /&gt;
create table regis as&lt;BR /&gt;
SELECT distinct&lt;BR /&gt;
        ID,&lt;BR /&gt;
        other_vars,&lt;BR /&gt;
        last_var&lt;BR /&gt;
    &lt;BR /&gt;
FROM connection to odbc (select * from oracle_odbc_table)&lt;BR /&gt;
   where id in (select non_retain.id from local.dataset);&lt;BR /&gt;
&lt;BR /&gt;
QUIT;&lt;BR /&gt;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;BR /&gt;
The above code creates the error message: ERROR: The following columns were not found in the contributing tables: (and it list the vars from the select statement)&lt;BR /&gt;
&lt;BR /&gt;
The only var in the local dataset are the ids that I want to pass to the where clause. &lt;BR /&gt;
&lt;BR /&gt;
Is this possible to pass information through a where clause via ODBC from a local dataset or am I doing something wrong?</description>
    <pubDate>Mon, 18 May 2009 15:56:11 GMT</pubDate>
    <dc:creator>Jay</dc:creator>
    <dc:date>2009-05-18T15:56:11Z</dc:date>
    <item>
      <title>SQL - ODBC - using "in" from a local dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SQL-ODBC-using-quot-in-quot-from-a-local-dataset/m-p/33329#M8065</link>
      <description>proc sql;&lt;BR /&gt;
connect to odbc(dsn=DSNname uid=user_id password=XXXXXXX);&lt;BR /&gt;
create table regis as&lt;BR /&gt;
SELECT distinct&lt;BR /&gt;
        ID,&lt;BR /&gt;
        other_vars,&lt;BR /&gt;
        last_var&lt;BR /&gt;
    &lt;BR /&gt;
FROM connection to odbc (select * from oracle_odbc_table)&lt;BR /&gt;
   where id in (select non_retain.id from local.dataset);&lt;BR /&gt;
&lt;BR /&gt;
QUIT;&lt;BR /&gt;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;BR /&gt;
The above code creates the error message: ERROR: The following columns were not found in the contributing tables: (and it list the vars from the select statement)&lt;BR /&gt;
&lt;BR /&gt;
The only var in the local dataset are the ids that I want to pass to the where clause. &lt;BR /&gt;
&lt;BR /&gt;
Is this possible to pass information through a where clause via ODBC from a local dataset or am I doing something wrong?</description>
      <pubDate>Mon, 18 May 2009 15:56:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SQL-ODBC-using-quot-in-quot-from-a-local-dataset/m-p/33329#M8065</guid>
      <dc:creator>Jay</dc:creator>
      <dc:date>2009-05-18T15:56:11Z</dc:date>
    </item>
    <item>
      <title>Re: SQL - ODBC - using "in" from a local dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SQL-ODBC-using-quot-in-quot-from-a-local-dataset/m-p/33330#M8066</link>
      <description>You are effectively doing a join between a Oracle table and a local table, but you appear to be mixing pass-through and LIBNAME syntax.  If you want to joint an ODBC connected table to a local table, you have to use the LIBNAME syntax.  Be warned, however, that the join will occur completely on the SAS side; Oracle has to send the entire table across the wire.&lt;BR /&gt;
&lt;BR /&gt;
If you have adequate permissions, you might be able to upload the ID list to Oracle and do the join there.&lt;BR /&gt;
&lt;BR /&gt;
Another approach, sort of a last resort, would be to use DATA step to build the code with the WHERE clause listing the actual IDs, saving the code with PUT statements, and the %INCLUDE-ing it later in the job.  I use this approach only when the two approaches above are not feasible.&lt;BR /&gt;
&lt;BR /&gt;
Doc Muhlbaier&lt;BR /&gt;
Duke</description>
      <pubDate>Mon, 18 May 2009 19:18:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SQL-ODBC-using-quot-in-quot-from-a-local-dataset/m-p/33330#M8066</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2009-05-18T19:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: SQL - ODBC - using "in" from a local dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SQL-ODBC-using-quot-in-quot-from-a-local-dataset/m-p/33331#M8067</link>
      <description>&amp;gt;&amp;gt;&amp;gt;mixing pass-through and LIBNAME syntax&lt;BR /&gt;
&lt;BR /&gt;
Yes, exactly what I was trying to do.&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt;&amp;gt;Oracle has to send the entire table across the wire&lt;BR /&gt;
&lt;BR /&gt;
Trying to join it via the libname was just to slow. &lt;BR /&gt;
&lt;BR /&gt;
Speed / time wise, found it faster to just change my where clause, bring  over all of the records from the next period and perform the join on my local SAS session. &lt;BR /&gt;
&lt;BR /&gt;
Thxs,&lt;BR /&gt;
Jay</description>
      <pubDate>Mon, 18 May 2009 19:43:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SQL-ODBC-using-quot-in-quot-from-a-local-dataset/m-p/33331#M8067</guid>
      <dc:creator>Jay</dc:creator>
      <dc:date>2009-05-18T19:43:10Z</dc:date>
    </item>
  </channel>
</rss>

