<?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 How to write SQL join with derived joinkey efficiently in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-write-SQL-join-with-derived-joinkey-efficiently/m-p/510581#M1981</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I performs an SQL join with a derived join key, I separates the step into&amp;nbsp;proc sql. One to drive the joinkey and another to actually perform the join. I wonder if someone know of a more efficient way&amp;nbsp;to do this.&amp;nbsp;A simple example below to illustrate,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create&amp;nbsp;view prep_table as&lt;/P&gt;&lt;P&gt;&amp;nbsp; select * ,put(raw_var, $someformat.) as joinkey&lt;/P&gt;&lt;P&gt;&amp;nbsp; from main_table;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;create table output_table as&lt;/P&gt;&lt;P&gt;&amp;nbsp; select a.var ,b.var2&lt;/P&gt;&lt;P&gt;&amp;nbsp; from prep_table as a&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; left join sub_table as b&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; on a.joinkey = b.joinkey;&lt;/P&gt;&lt;P&gt;&amp;nbsp; quit;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 05 Nov 2018 20:04:09 GMT</pubDate>
    <dc:creator>DucatiJong</dc:creator>
    <dc:date>2018-11-05T20:04:09Z</dc:date>
    <item>
      <title>How to write SQL join with derived joinkey efficiently</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-write-SQL-join-with-derived-joinkey-efficiently/m-p/510581#M1981</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I performs an SQL join with a derived join key, I separates the step into&amp;nbsp;proc sql. One to drive the joinkey and another to actually perform the join. I wonder if someone know of a more efficient way&amp;nbsp;to do this.&amp;nbsp;A simple example below to illustrate,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create&amp;nbsp;view prep_table as&lt;/P&gt;&lt;P&gt;&amp;nbsp; select * ,put(raw_var, $someformat.) as joinkey&lt;/P&gt;&lt;P&gt;&amp;nbsp; from main_table;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;create table output_table as&lt;/P&gt;&lt;P&gt;&amp;nbsp; select a.var ,b.var2&lt;/P&gt;&lt;P&gt;&amp;nbsp; from prep_table as a&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; left join sub_table as b&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; on a.joinkey = b.joinkey;&lt;/P&gt;&lt;P&gt;&amp;nbsp; quit;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Nov 2018 20:04:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-write-SQL-join-with-derived-joinkey-efficiently/m-p/510581#M1981</guid>
      <dc:creator>DucatiJong</dc:creator>
      <dc:date>2018-11-05T20:04:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to write SQL join with derived joinkey efficiently</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-write-SQL-join-with-derived-joinkey-efficiently/m-p/510602#M1989</link>
      <description>&lt;P&gt;but what is point to make another column in the view, unless your building a index or something useful. You can do pretty much in same step as&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  create table output_table as

  select a.var ,b.var2

  from prep_table as a

    left join sub_table as b

      on &lt;SPAN&gt;put(a.raw_var, $someformat.)&lt;/SPAN&gt; = b.joinkey;

  quit;  &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Nov 2018 21:20:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-write-SQL-join-with-derived-joinkey-efficiently/m-p/510602#M1989</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2018-11-05T21:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to write SQL join with derived joinkey efficiently</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-write-SQL-join-with-derived-joinkey-efficiently/m-p/510618#M1994</link>
      <description>&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 05 Nov 2018 22:05:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-write-SQL-join-with-derived-joinkey-efficiently/m-p/510618#M1994</guid>
      <dc:creator>DucatiJong</dc:creator>
      <dc:date>2018-11-05T22:05:42Z</dc:date>
    </item>
  </channel>
</rss>

