<?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 Efficient Proc Sql Joining in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Efficient-Proc-Sql-Joining/m-p/387823#M93007</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Trying to create a left outer join with a table on the server. TableB is on the server and is a huge table, and TableA is the local table:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt; &lt;STRONG&gt;SQL&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;CREATE TABLE NEW AS&lt;/P&gt;&lt;P&gt;SELECT a.*,&lt;/P&gt;&lt;P&gt;b.VAR1, b.VAR2, b.VAR3, b.VAR4, b.VAR5&lt;/P&gt;&lt;P&gt;FROM TableA AS a&lt;/P&gt;&lt;P&gt;LEFT OUTER JOIN &lt;STRONG&gt;TABLEB&lt;/STRONG&gt; AS b&lt;/P&gt;&lt;P&gt;ON a.ID = b.ID;&lt;/P&gt;&lt;P&gt;QUIT;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code is taking very long actually more than 2 hours. Is there an efficient way I should run this code? like creating a temp table from the server and using that to join TableA.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Aug 2017 15:39:22 GMT</pubDate>
    <dc:creator>AZIQ1</dc:creator>
    <dc:date>2017-08-14T15:39:22Z</dc:date>
    <item>
      <title>Efficient Proc Sql Joining</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Efficient-Proc-Sql-Joining/m-p/387823#M93007</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Trying to create a left outer join with a table on the server. TableB is on the server and is a huge table, and TableA is the local table:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt; &lt;STRONG&gt;SQL&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;CREATE TABLE NEW AS&lt;/P&gt;&lt;P&gt;SELECT a.*,&lt;/P&gt;&lt;P&gt;b.VAR1, b.VAR2, b.VAR3, b.VAR4, b.VAR5&lt;/P&gt;&lt;P&gt;FROM TableA AS a&lt;/P&gt;&lt;P&gt;LEFT OUTER JOIN &lt;STRONG&gt;TABLEB&lt;/STRONG&gt; AS b&lt;/P&gt;&lt;P&gt;ON a.ID = b.ID;&lt;/P&gt;&lt;P&gt;QUIT;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code is taking very long actually more than 2 hours. Is there an efficient way I should run this code? like creating a temp table from the server and using that to join TableA.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2017 15:39:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Efficient-Proc-Sql-Joining/m-p/387823#M93007</guid>
      <dc:creator>AZIQ1</dc:creator>
      <dc:date>2017-08-14T15:39:22Z</dc:date>
    </item>
    <item>
      <title>Re: Efficient Proc Sql Joining</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Efficient-Proc-Sql-Joining/m-p/387826#M93009</link>
      <description>&lt;P&gt;How big is Table A?&lt;/P&gt;
&lt;P&gt;If it's smaller, you can consider creating macro variable that has the values you want and then you can filter it first and then join once it's been extracted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;create tableB_Sub as&lt;/P&gt;
&lt;P&gt;select&amp;nbsp;&lt;SPAN&gt;b.VAR1, b.VAR2, b.VAR3, b.VAR4, b.VAR5&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;from tableB as b&lt;/P&gt;
&lt;P&gt;where ID in ( LIST OF IDS HERE);&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then join afterwards.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2017 15:44:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Efficient-Proc-Sql-Joining/m-p/387826#M93009</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-08-14T15:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: Efficient Proc Sql Joining</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Efficient-Proc-Sql-Joining/m-p/387847#M93019</link>
      <description>Thank you this worked.</description>
      <pubDate>Mon, 14 Aug 2017 16:24:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Efficient-Proc-Sql-Joining/m-p/387847#M93019</guid>
      <dc:creator>AZIQ1</dc:creator>
      <dc:date>2017-08-14T16:24:34Z</dc:date>
    </item>
    <item>
      <title>Re: Efficient Proc Sql Joining</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Efficient-Proc-Sql-Joining/m-p/387849#M93020</link>
      <description>&lt;P&gt;Have you validated that there are indexes on the columns you are joining on (a.ID and b.ID)? &amp;nbsp;In my experience, indexes are critical for efficient queries.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2017 16:26:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Efficient-Proc-Sql-Joining/m-p/387849#M93020</guid>
      <dc:creator>utrocketeng</dc:creator>
      <dc:date>2017-08-14T16:26:52Z</dc:date>
    </item>
    <item>
      <title>Re: Efficient Proc Sql Joining</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Efficient-Proc-Sql-Joining/m-p/387863#M93023</link>
      <description>&lt;P&gt;When joining a table from the server with a local table SAS firsts brings down the entire table from the server and does the work locally. This is inefficient, so first subsetting the table and bringing it down helps to speed it up.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2017 17:05:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Efficient-Proc-Sql-Joining/m-p/387863#M93023</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-08-14T17:05:08Z</dc:date>
    </item>
    <item>
      <title>Re: Efficient Proc Sql Joining</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Efficient-Proc-Sql-Joining/m-p/388409#M93159</link>
      <description>&lt;P&gt;Reeza,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the reason you described, i have become a proponet within my company to leverage pass through PROC SQL queries. &amp;nbsp;if the table hosted within SAS is reasonably small, i will write it up to the remote server as a temp table then do the join with that db.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Aug 2017 11:54:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Efficient-Proc-Sql-Joining/m-p/388409#M93159</guid>
      <dc:creator>utrocketeng</dc:creator>
      <dc:date>2017-08-16T11:54:07Z</dc:date>
    </item>
  </channel>
</rss>

