<?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 Passthrough DB2 and SQL in same iteration in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Passthrough-DB2-and-SQL-in-same-iteration/m-p/786568#M251161</link>
    <description>&lt;PRE&gt;proc sql noprint; 
connect  to DB2 (&amp;amp;cpplogin);
create table t_escrow as select * from connection to db2
   ( SELECT distinct *
     FROM DX.T_escrow_1
	  WHERE tran_date &amp;gt;= '2019-01-01'
	  and loan_num in ('2211','3123','908766','9876') /*need to replace this line with
	  a new select statement and new passthrough connection.*/
		and UPDATE_CD IN ('A','C')   
  	  order by ln_no,tran_date desc
		 	    WITH UR  
   );
     disconnect from db2;
quit;


proc sql;
        connect to sqlsvr (&amp;amp;dlogin_new.);
        CREATE TABLE loan_lookup AS 
        (       SELECT * FROM connection to sqlsvr 
               (       
                       
			   	select lnbr
                       FROM D_Tran.dbo.DT_DBBT_Lookup
               )
        )
        ;
        disconnect from sqlsvr;
        run;
quit;&lt;/PRE&gt;
&lt;P&gt;I need to integrate&amp;nbsp;loan_lookup into the&amp;nbsp;t_escrow table.&amp;nbsp; It will be filtered based on the&amp;nbsp;loan_lookup query however notice the connections are slightly different.&amp;nbsp; Would I need to run the queries separately then combine them (not preferred) or is there a way to handle this in the same iteration despite two different connection strings&lt;/P&gt;</description>
    <pubDate>Sat, 18 Dec 2021 00:06:23 GMT</pubDate>
    <dc:creator>Q1983</dc:creator>
    <dc:date>2021-12-18T00:06:23Z</dc:date>
    <item>
      <title>Passthrough DB2 and SQL in same iteration</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Passthrough-DB2-and-SQL-in-same-iteration/m-p/786568#M251161</link>
      <description>&lt;PRE&gt;proc sql noprint; 
connect  to DB2 (&amp;amp;cpplogin);
create table t_escrow as select * from connection to db2
   ( SELECT distinct *
     FROM DX.T_escrow_1
	  WHERE tran_date &amp;gt;= '2019-01-01'
	  and loan_num in ('2211','3123','908766','9876') /*need to replace this line with
	  a new select statement and new passthrough connection.*/
		and UPDATE_CD IN ('A','C')   
  	  order by ln_no,tran_date desc
		 	    WITH UR  
   );
     disconnect from db2;
quit;


proc sql;
        connect to sqlsvr (&amp;amp;dlogin_new.);
        CREATE TABLE loan_lookup AS 
        (       SELECT * FROM connection to sqlsvr 
               (       
                       
			   	select lnbr
                       FROM D_Tran.dbo.DT_DBBT_Lookup
               )
        )
        ;
        disconnect from sqlsvr;
        run;
quit;&lt;/PRE&gt;
&lt;P&gt;I need to integrate&amp;nbsp;loan_lookup into the&amp;nbsp;t_escrow table.&amp;nbsp; It will be filtered based on the&amp;nbsp;loan_lookup query however notice the connections are slightly different.&amp;nbsp; Would I need to run the queries separately then combine them (not preferred) or is there a way to handle this in the same iteration despite two different connection strings&lt;/P&gt;</description>
      <pubDate>Sat, 18 Dec 2021 00:06:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Passthrough-DB2-and-SQL-in-same-iteration/m-p/786568#M251161</guid>
      <dc:creator>Q1983</dc:creator>
      <dc:date>2021-12-18T00:06:23Z</dc:date>
    </item>
    <item>
      <title>Re: Passthrough DB2 and SQL in same iteration</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Passthrough-DB2-and-SQL-in-same-iteration/m-p/786569#M251162</link>
      <description>&lt;P&gt;I don't understand what the question is.&amp;nbsp; You can definitely be connected to multiple external databases at the same time.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  connect to a;
  connect to b;
  create table c as
   select * 
   from (select * from connection to a (select * from table_in_a)) a
   left join (select * from connection to b (select * from table_in_b)) b
  on a.id = b.id
  ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But I have a feeling you are trying to ask a different question.&lt;/P&gt;</description>
      <pubDate>Sat, 18 Dec 2021 00:11:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Passthrough-DB2-and-SQL-in-same-iteration/m-p/786569#M251162</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-12-18T00:11:37Z</dc:date>
    </item>
  </channel>
</rss>

