<?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 Merging tables on shortened version of variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Merging-tables-on-shortened-version-of-variable/m-p/579177#M164380</link>
    <description>&lt;P&gt;Hi!&amp;nbsp; I need to merge two tables, but the 2 variables that I'm matching on don't match exactly.&amp;nbsp; The variable in the first table is 11 characters and the other is 9 (between the 2nd and 9th digit of the first).&amp;nbsp; I would like to do this in a proc sql step if possible.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;table 1&lt;/P&gt;&lt;P&gt;z2345678900&lt;/P&gt;&lt;P&gt;x3333333300&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;table 2&lt;/P&gt;&lt;P&gt;23456789&lt;/P&gt;&lt;P&gt;33333333&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 05 Aug 2019 16:37:49 GMT</pubDate>
    <dc:creator>jmmedina25</dc:creator>
    <dc:date>2019-08-05T16:37:49Z</dc:date>
    <item>
      <title>Merging tables on shortened version of variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-tables-on-shortened-version-of-variable/m-p/579177#M164380</link>
      <description>&lt;P&gt;Hi!&amp;nbsp; I need to merge two tables, but the 2 variables that I'm matching on don't match exactly.&amp;nbsp; The variable in the first table is 11 characters and the other is 9 (between the 2nd and 9th digit of the first).&amp;nbsp; I would like to do this in a proc sql step if possible.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;table 1&lt;/P&gt;&lt;P&gt;z2345678900&lt;/P&gt;&lt;P&gt;x3333333300&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;table 2&lt;/P&gt;&lt;P&gt;23456789&lt;/P&gt;&lt;P&gt;33333333&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2019 16:37:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-tables-on-shortened-version-of-variable/m-p/579177#M164380</guid>
      <dc:creator>jmmedina25</dc:creator>
      <dc:date>2019-08-05T16:37:49Z</dc:date>
    </item>
    <item>
      <title>Re: Merging tables on shortened version of variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-tables-on-shortened-version-of-variable/m-p/579181#M164381</link>
      <description>&lt;P&gt;Please try the below code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data table1;
input text$20.;
cards;
z2345678900
x3333333300
;
 
data table2;
input text$;
cards;
23456789
33333333
;


proc sql;
create table want as select a.text, b.text as text2 from table1 as a , table2 as b where substr(a.text,2,8)=b.text;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Aug 2019 16:53:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-tables-on-shortened-version-of-variable/m-p/579181#M164381</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2019-08-05T16:53:06Z</dc:date>
    </item>
  </channel>
</rss>

