<?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: Proc Sql pass through on multiple server in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Proc-Sql-pass-through-on-multiple-server/m-p/450080#M13879</link>
    <description>&lt;P&gt;A SAS SQL passthru connection can only go to one database server at a time. If the tables you are joining are not very big then the easiest option is to read both tables into SAS first, then join entirely in SAS. If they are big, then you could consider reading the smaller one into SAS, then loading it into the other database as a temporary table, then do an in-database join.&lt;/P&gt;</description>
    <pubDate>Fri, 30 Mar 2018 22:22:04 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2018-03-30T22:22:04Z</dc:date>
    <item>
      <title>Proc Sql pass through on multiple server</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Proc-Sql-pass-through-on-multiple-server/m-p/450052#M13878</link>
      <description>&lt;P&gt;I am trying to join tables in two different servers.&amp;nbsp;&lt;/P&gt;&lt;P&gt;my question is:&lt;/P&gt;&lt;P&gt;1) is it possible?&lt;/P&gt;&lt;P&gt;2) if so, How do I point to both connection ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;Connect to odbc as a(noprompt = "server=server1;DRIVER=&lt;EM&gt;&lt;STRONG&gt;SQL&lt;/STRONG&gt;&lt;/EM&gt; Server;Trusted Connection=yes;");&lt;BR /&gt;Connect to odbc as b(noprompt = "server=server2;DRIVER=&lt;STRONG&gt;&lt;EM&gt;Postgre SQL Server&lt;/EM&gt;&lt;/STRONG&gt;;Trusted Connection=yes;");&lt;/P&gt;&lt;P&gt;Create table ml as&lt;BR /&gt;Select * from connection to odbc &lt;STRONG&gt;(????a and b????)&lt;/STRONG&gt;&lt;BR /&gt;(SELECT m.*&lt;BR /&gt;from a.labs.dbo.vw_message_logging m&lt;BR /&gt;left join (SELECT DISTINCT e.loinc&lt;/P&gt;&lt;P&gt;FROM elr.elr.vocab_master&amp;nbsp;e&lt;BR /&gt;) c on c.loinc=m.loinc&lt;BR /&gt;where c.loinc is not null and m.date between 'xxxxx' and 'xxxxxx');&lt;BR /&gt;disconnect from odbc ;&lt;BR /&gt;quit;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 30 Mar 2018 20:15:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Proc-Sql-pass-through-on-multiple-server/m-p/450052#M13878</guid>
      <dc:creator>HabAM</dc:creator>
      <dc:date>2018-03-30T20:15:49Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sql pass through on multiple server</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Proc-Sql-pass-through-on-multiple-server/m-p/450080#M13879</link>
      <description>&lt;P&gt;A SAS SQL passthru connection can only go to one database server at a time. If the tables you are joining are not very big then the easiest option is to read both tables into SAS first, then join entirely in SAS. If they are big, then you could consider reading the smaller one into SAS, then loading it into the other database as a temporary table, then do an in-database join.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Mar 2018 22:22:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Proc-Sql-pass-through-on-multiple-server/m-p/450080#M13879</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2018-03-30T22:22:04Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sql pass through on multiple server</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Proc-Sql-pass-through-on-multiple-server/m-p/450113#M13881</link>
      <description>Even though I haven't tried it, but I think it's possible for SQL Server to access PostgreSQL data via ODBC as linked tables. In this way you may be able to perform the join in SQL Server, thus only need to move one table prior to the join. &lt;BR /&gt;The other way around might also be possible. &lt;BR /&gt;Either way, solving it this way is not a SAS issue since it's about RDBMS functionally.</description>
      <pubDate>Sat, 31 Mar 2018 10:18:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Proc-Sql-pass-through-on-multiple-server/m-p/450113#M13881</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2018-03-31T10:18:12Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sql pass through on multiple server</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Proc-Sql-pass-through-on-multiple-server/m-p/450243#M13886</link>
      <description>&lt;P&gt;There is another technique that could work for you, depending on volume. You can set up a macro variable with the values you need to join, and then use that to extract the data from your second table. I've mocked up an example below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
	select name into :NameList separated by '", "'
		from sashelp.class
			where sex="M";
quit;

%let NameList = "&amp;amp;NameList";
%put &amp;amp;NameList;

proc sql noprint;
	create table Test as
		select *
			from sashelp.class
				where name in(&amp;amp;NameList);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 01 Apr 2018 16:09:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Proc-Sql-pass-through-on-multiple-server/m-p/450243#M13886</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2018-04-01T16:09:08Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sql pass through on multiple server</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Proc-Sql-pass-through-on-multiple-server/m-p/450291#M13887</link>
      <description>&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Apr 2018 03:21:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Proc-Sql-pass-through-on-multiple-server/m-p/450291#M13887</guid>
      <dc:creator>HabAM</dc:creator>
      <dc:date>2018-04-02T03:21:28Z</dc:date>
    </item>
  </channel>
</rss>

