<?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: how to join db2 data with local data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-join-db2-data-with-local-data/m-p/437369#M108880</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First thing when your using Explicit pass-through is the query runs entirely in the database and gets you the result to SAS.&amp;nbsp;&lt;SPAN&gt;Explicit pass-through can't be used if tables are in different platform( DB2 table and SAS table "Heterogeneous" ).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If your SAS table is very small and want to join with DB2 table which is very large by avoiding SAS to bring the large DB2 data&amp;nbsp; into SAS environment the efficient way is load the SAS table into DB2 and then you can do in-database queries.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Note: Creating a permanent tables is restricted to most users in many environments. In this case check if you can create a DBMS temp table.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 14 Feb 2018 22:07:24 GMT</pubDate>
    <dc:creator>SuryaKiran</dc:creator>
    <dc:date>2018-02-14T22:07:24Z</dc:date>
    <item>
      <title>how to join db2 data with local data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-join-db2-data-with-local-data/m-p/437335#M108875</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Here is what I want:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;libname here './'; run;

proc sql;
&amp;nbsp; &amp;nbsp;connect to db2&amp;nbsp; &amp;nbsp; &amp;nbsp;d;
&amp;nbsp; &amp;nbsp;create table here.tmp as&amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; select
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; from
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;d, here.stuff h
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; where
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;d.thing=h.thing
&amp;nbsp; &amp;nbsp; &amp;nbsp;;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried below example with no joy. I hope there is a simple solution from you fantastic people!!!&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/acreldb/63647/HTML/default/viewer.htm#a002678734.htm" target="_self"&gt;http://support.sas.com/documentation/cdl/en/acreldb/63647/HTML/default/viewer.htm#a002678734.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2018 20:59:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-join-db2-data-with-local-data/m-p/437335#M108875</guid>
      <dc:creator>cellurl</dc:creator>
      <dc:date>2018-02-14T20:59:45Z</dc:date>
    </item>
    <item>
      <title>Re: how to join db2 data with local data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-join-db2-data-with-local-data/m-p/437350#M108877</link>
      <description>&lt;P&gt;Can you connect to your DB2 using a libname as well? SQL pass through is the same thing as working entirely on your server so you can't see the local data anymore so that approach won't work.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another common workaround is to select the list of 'things' required, pass that as a macro variable to filter it first and then join the data on the SAS side after the remaining portion is received.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2018 21:03:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-join-db2-data-with-local-data/m-p/437350#M108877</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-02-14T21:03:55Z</dc:date>
    </item>
    <item>
      <title>Re: how to join db2 data with local data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-join-db2-data-with-local-data/m-p/437369#M108880</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First thing when your using Explicit pass-through is the query runs entirely in the database and gets you the result to SAS.&amp;nbsp;&lt;SPAN&gt;Explicit pass-through can't be used if tables are in different platform( DB2 table and SAS table "Heterogeneous" ).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If your SAS table is very small and want to join with DB2 table which is very large by avoiding SAS to bring the large DB2 data&amp;nbsp; into SAS environment the efficient way is load the SAS table into DB2 and then you can do in-database queries.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Note: Creating a permanent tables is restricted to most users in many environments. In this case check if you can create a DBMS temp table.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2018 22:07:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-join-db2-data-with-local-data/m-p/437369#M108880</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-02-14T22:07:24Z</dc:date>
    </item>
    <item>
      <title>Re: how to join db2 data with local data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-join-db2-data-with-local-data/m-p/437371#M108881</link>
      <description>&lt;P&gt;You cannot use connect statement and&amp;nbsp; do the join. Once you use connect statement all the queries are moved to the DB2 server and will not have no clue about SAS tables.&lt;/P&gt;
&lt;P&gt;One way to&amp;nbsp;accomplish this is by using implicit pass through which is by doing libname for db2 and then doing join&lt;/P&gt;
&lt;P&gt;as shown below.&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/83078"&gt;@SuryaKiran&lt;/a&gt;&amp;nbsp;has some&amp;nbsp; good suggestions how to do this very efficiently.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;libname here './'; 
libname mylib db2 user=user-id password=password datasrc=data-source-name;
proc sql;
&amp;nbsp;
&amp;nbsp; &amp;nbsp;create table here.tmp as&amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; select
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; from
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;mylib.d o, here.stuff h
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; where
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;o.thing=h.thing
&amp;nbsp; &amp;nbsp; &amp;nbsp;;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2018 22:17:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-join-db2-data-with-local-data/m-p/437371#M108881</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2018-02-14T22:17:40Z</dc:date>
    </item>
    <item>
      <title>Re: how to join db2 data with local data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-join-db2-data-with-local-data/m-p/437695#M109030</link>
      <description>thanks. Code is always best! thanks Kiranv.</description>
      <pubDate>Thu, 15 Feb 2018 17:01:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-join-db2-data-with-local-data/m-p/437695#M109030</guid>
      <dc:creator>cellurl</dc:creator>
      <dc:date>2018-02-15T17:01:09Z</dc:date>
    </item>
  </channel>
</rss>

