<?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: Joining string's of different length in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Joining-string-s-of-different-length/m-p/295760#M61844</link>
    <description>&lt;P&gt;Make them the same, either strip leading 0 or add leading zero.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Add leading 0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;put( var, z11.)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Remove leading 0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;input(var, best12.)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can either create a new variable and merge using the new variable or do conversion on join condition if using SQL.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Eg:&lt;/P&gt;
&lt;P&gt;T1= put(...)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 01 Sep 2016 09:53:44 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-09-01T09:53:44Z</dc:date>
    <item>
      <title>Joining string's of different length</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Joining-string-s-of-different-length/m-p/295757#M61843</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I find that I am in need of some advice again…&lt;/P&gt;&lt;P&gt;I have to join two tables, t1 has an 11 digit number, t2 is a matching number, but the string is only between 6 and 11 digits.&amp;nbsp; If starting from the last number in the string (the furthest right number) the numbers will match. i.e.&amp;nbsp; Both number are formatted as a character ($12.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;T1&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;T2&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;00000456789&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;456789&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;00003456789&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3456789&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;00023456789&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;23456789&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I add 0’s to the string in T2 to make it an 11 digit number? &amp;nbsp;Or is there a better way to join them?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I’m very new to all of this, so if you could explain it as if speaking to a child, that would be great.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for your time,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;paul&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2016 09:46:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Joining-string-s-of-different-length/m-p/295757#M61843</guid>
      <dc:creator>pandhandj</dc:creator>
      <dc:date>2016-09-01T09:46:25Z</dc:date>
    </item>
    <item>
      <title>Re: Joining string's of different length</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Joining-string-s-of-different-length/m-p/295760#M61844</link>
      <description>&lt;P&gt;Make them the same, either strip leading 0 or add leading zero.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Add leading 0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;put( var, z11.)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Remove leading 0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;input(var, best12.)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can either create a new variable and merge using the new variable or do conversion on join condition if using SQL.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Eg:&lt;/P&gt;
&lt;P&gt;T1= put(...)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2016 09:53:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Joining-string-s-of-different-length/m-p/295760#M61844</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-09-01T09:53:44Z</dc:date>
    </item>
    <item>
      <title>Re: Joining string's of different length</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Joining-string-s-of-different-length/m-p/295761#M61845</link>
      <description>&lt;P&gt;Sorry, missed portion about T2 already being character.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can convert to numeric to implement solution or use repeat to generate number of 0 based on length and concatenate VM,yes.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Untested&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Repeat(0, 11-length(t2)) || &amp;nbsp;t2&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2016 09:56:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Joining-string-s-of-different-length/m-p/295761#M61845</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-09-01T09:56:47Z</dc:date>
    </item>
    <item>
      <title>Re: Joining string's of different length</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Joining-string-s-of-different-length/m-p/295866#M61879</link>
      <description>Hi Reeza, thanks for your input. I worked it out from what you said above. Initially the shorter number was Numeric, I had changed it in a previous step. So I went pack there and padded the 0's to the front and it worked great. thanks for your time, paul</description>
      <pubDate>Thu, 01 Sep 2016 14:54:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Joining-string-s-of-different-length/m-p/295866#M61879</guid>
      <dc:creator>pandhandj</dc:creator>
      <dc:date>2016-09-01T14:54:20Z</dc:date>
    </item>
  </channel>
</rss>

