<?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 Using SAS Dataset as part of In Clause of PROC SQL to DB2 in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Using-SAS-Dataset-as-part-of-In-Clause-of-PROC-SQL-to-DB2/m-p/15145#M2609</link>
    <description>Hello.&lt;BR /&gt;
&lt;BR /&gt;
I am attempting to use a 100 record dataset to limit the accounts from a DB2 connection into a table holding 100s of Millions.  &lt;BR /&gt;
&lt;BR /&gt;
Currently, I am hard coding 7 of the accounts in the In(), but would like to use a SAS Dataset in place of.  Please help.&lt;BR /&gt;
&lt;BR /&gt;
proc sql ;&lt;BR /&gt;
     connect to db2(%login) ;&lt;BR /&gt;
&lt;BR /&gt;
create table Library.Table as &lt;BR /&gt;
select 		* &lt;BR /&gt;
from 		connection to db2 &lt;BR /&gt;
			(&lt;BR /&gt;
			Select	*&lt;BR /&gt;
			From	schema.table&lt;BR /&gt;
			Where	Acct In (X,X,X,X,X,X,X)&lt;BR /&gt;
			) &lt;BR /&gt;
;&lt;BR /&gt;
&lt;BR /&gt;
disconnect from db2;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
Where X = an Acct#</description>
    <pubDate>Tue, 04 May 2010 17:10:39 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2010-05-04T17:10:39Z</dc:date>
    <item>
      <title>Using SAS Dataset as part of In Clause of PROC SQL to DB2</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-SAS-Dataset-as-part-of-In-Clause-of-PROC-SQL-to-DB2/m-p/15145#M2609</link>
      <description>Hello.&lt;BR /&gt;
&lt;BR /&gt;
I am attempting to use a 100 record dataset to limit the accounts from a DB2 connection into a table holding 100s of Millions.  &lt;BR /&gt;
&lt;BR /&gt;
Currently, I am hard coding 7 of the accounts in the In(), but would like to use a SAS Dataset in place of.  Please help.&lt;BR /&gt;
&lt;BR /&gt;
proc sql ;&lt;BR /&gt;
     connect to db2(%login) ;&lt;BR /&gt;
&lt;BR /&gt;
create table Library.Table as &lt;BR /&gt;
select 		* &lt;BR /&gt;
from 		connection to db2 &lt;BR /&gt;
			(&lt;BR /&gt;
			Select	*&lt;BR /&gt;
			From	schema.table&lt;BR /&gt;
			Where	Acct In (X,X,X,X,X,X,X)&lt;BR /&gt;
			) &lt;BR /&gt;
;&lt;BR /&gt;
&lt;BR /&gt;
disconnect from db2;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
Where X = an Acct#</description>
      <pubDate>Tue, 04 May 2010 17:10:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-SAS-Dataset-as-part-of-In-Clause-of-PROC-SQL-to-DB2/m-p/15145#M2609</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-05-04T17:10:39Z</dc:date>
    </item>
    <item>
      <title>Re: Using SAS Dataset as part of In Clause of PROC SQL to DB2</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-SAS-Dataset-as-part-of-In-Clause-of-PROC-SQL-to-DB2/m-p/15146#M2610</link>
      <description>The best approach here is to create a temporary table in DB2 to do the join.</description>
      <pubDate>Tue, 04 May 2010 17:56:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-SAS-Dataset-as-part-of-In-Clause-of-PROC-SQL-to-DB2/m-p/15146#M2610</guid>
      <dc:creator>Flip</dc:creator>
      <dc:date>2010-05-04T17:56:50Z</dc:date>
    </item>
    <item>
      <title>Re: Using SAS Dataset as part of In Clause of PROC SQL to DB2</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-SAS-Dataset-as-part-of-In-Clause-of-PROC-SQL-to-DB2/m-p/15147#M2611</link>
      <description>you can try&lt;BR /&gt;
1) subquery to create list of customer id's &lt;BR /&gt;
2) create macro variable/s of customer id's from local sas table and use in sql query&lt;BR /&gt;
&lt;BR /&gt;
HTH</description>
      <pubDate>Tue, 04 May 2010 18:24:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-SAS-Dataset-as-part-of-In-Clause-of-PROC-SQL-to-DB2/m-p/15147#M2611</guid>
      <dc:creator>sfsdtegsdsdgdffhgfh</dc:creator>
      <dc:date>2010-05-04T18:24:29Z</dc:date>
    </item>
    <item>
      <title>Re: Using SAS Dataset as part of In Clause of PROC SQL to DB2</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-SAS-Dataset-as-part-of-In-Clause-of-PROC-SQL-to-DB2/m-p/15148#M2612</link>
      <description>since there are no more than 100 observations in your SAS table, put the account column into a macro variable to use as the in-list, like:[pre]  proc sql noprint ;&lt;BR /&gt;
   select distinct acct &lt;BR /&gt;
     into : in_list separated by ', '&lt;BR /&gt;
   from sas_table&lt;BR /&gt;
 ;&lt;BR /&gt;
%put have &amp;amp;sqlobs in the &amp;amp;in_list ;&lt;BR /&gt;
&lt;BR /&gt;
create table Library.Table as &lt;BR /&gt;
      select * from connection to db2 &lt;BR /&gt;
            (&lt;BR /&gt;
             Select * From schema.table&lt;BR /&gt;
             Where Acct In( &amp;amp;in_list )&lt;BR /&gt;
            )&lt;BR /&gt;
     ; [/pre]&lt;BR /&gt;
I've used the technique successfully for 1000-item lists.&lt;BR /&gt;
The macro variable is resolved before the syntax is passed through SAS/Access to the data base. &lt;BR /&gt;
 &lt;BR /&gt;
good luck&lt;BR /&gt;
PeterC</description>
      <pubDate>Wed, 05 May 2010 20:00:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-SAS-Dataset-as-part-of-In-Clause-of-PROC-SQL-to-DB2/m-p/15148#M2612</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-05-05T20:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: Using SAS Dataset as part of In Clause of PROC SQL to DB2</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-SAS-Dataset-as-part-of-In-Clause-of-PROC-SQL-to-DB2/m-p/15149#M2613</link>
      <description>Another way is to use the DBKEY= ds option, and using implicit pass-thru (using a DB2 LIBANME instead).&lt;BR /&gt;
&lt;BR /&gt;
Cold work, and is definitely easier to code. Of course Acct needs to be indexed in DB2.&lt;BR /&gt;
&lt;BR /&gt;
/Linus</description>
      <pubDate>Thu, 06 May 2010 11:31:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-SAS-Dataset-as-part-of-In-Clause-of-PROC-SQL-to-DB2/m-p/15149#M2613</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2010-05-06T11:31:20Z</dc:date>
    </item>
  </channel>
</rss>

