<?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: Different format for matching two sql tables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Different-format-for-matching-two-sql-tables/m-p/314717#M68581</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Or I could think of another example involving our Grand Advisor's name&amp;nbsp;&lt;img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://communities.sas.com/i/smilies/16x16_smiley-very-happy.png" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Those would be the same though &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Grand Advisor? I hadn't noticed my elevated status. Better not let it get to my head!!&lt;/P&gt;</description>
    <pubDate>Mon, 28 Nov 2016 03:47:58 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-11-28T03:47:58Z</dc:date>
    <item>
      <title>Different format for matching two sql tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Different-format-for-matching-two-sql-tables/m-p/314700#M68575</link>
      <description>&lt;P&gt;I have two tables that I would like to match and I have the following code:&lt;/P&gt;&lt;P class="p1"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;sql&lt;/STRONG&gt;&lt;SPAN class="s1"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;create&lt;/SPAN&gt; &lt;SPAN class="s2"&gt;table&lt;/SPAN&gt;&amp;nbsp;want&amp;nbsp;&lt;SPAN class="s2"&gt;as&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;select&lt;/SPAN&gt; &lt;SPAN class="s2"&gt;distinct&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN class="s3"&gt;*&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;from have1&lt;/SPAN&gt; a&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="s2"&gt;as&lt;/SPAN&gt; a &lt;SPAN class="s2"&gt;left&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN class="s2"&gt;join&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; have 2&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="s2"&gt;as&lt;/SPAN&gt; b &lt;SPAN class="s2"&gt;on&lt;/SPAN&gt; a.ID=b.ID;&lt;/P&gt;&lt;P class="p1"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;SPAN class="s1"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;The problem is the ID in HAVE1 is of the sort:&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="s1"&gt;001003 and in table 2&amp;nbsp;&lt;SPAN&gt;1003. The format of both is Character $6. Why I can't match them.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&lt;SPAN&gt;How hcan I convert the IDs to be the same. Format is the same but there are zeros in front of the IDs in have 1.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2016 02:06:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Different-format-for-matching-two-sql-tables/m-p/314700#M68575</guid>
      <dc:creator>Agent1592</dc:creator>
      <dc:date>2016-11-28T02:06:44Z</dc:date>
    </item>
    <item>
      <title>Re: Different format for matching two sql tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Different-format-for-matching-two-sql-tables/m-p/314702#M68576</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/116288"&gt;@Agent1592&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;The problem is the ID in HAVE1 is of the sort:&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="s1"&gt;001003 and in table 2&amp;nbsp;&lt;SPAN&gt;1003. The format of both is Character $6. Why I can't match them.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Because they're characters and don't match, that's equivalent to saying "Alfred" and "fred" are the same.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to treat them as numbers, convert them to numbers in your join condition using INPUT.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;P class="p2"&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; have 2&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="s2"&gt;as&lt;/SPAN&gt; b &lt;SPAN class="s2"&gt;on&lt;/SPAN&gt;&amp;nbsp;&lt;STRONG&gt;input(a.ID, 8.)=input(b.ID, 8.)&lt;/STRONG&gt;;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2016 02:17:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Different-format-for-matching-two-sql-tables/m-p/314702#M68576</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-11-28T02:17:06Z</dc:date>
    </item>
    <item>
      <title>Re: Different format for matching two sql tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Different-format-for-matching-two-sql-tables/m-p/314705#M68577</link>
      <description>&lt;P&gt;Or I could think of another example involving our Grand Advisor's name&amp;nbsp;&lt;img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://communities.sas.com/i/smilies/16x16_smiley-very-happy.png" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2016 02:58:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Different-format-for-matching-two-sql-tables/m-p/314705#M68577</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-11-28T02:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: Different format for matching two sql tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Different-format-for-matching-two-sql-tables/m-p/314716#M68580</link>
      <description>&lt;PRE&gt;

   have 2 as b on prxchange('s/^0+//',1,a.ID)=b.ID;


&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Nov 2016 03:43:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Different-format-for-matching-two-sql-tables/m-p/314716#M68580</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-11-28T03:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: Different format for matching two sql tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Different-format-for-matching-two-sql-tables/m-p/314717#M68581</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Or I could think of another example involving our Grand Advisor's name&amp;nbsp;&lt;img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://communities.sas.com/i/smilies/16x16_smiley-very-happy.png" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Those would be the same though &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Grand Advisor? I hadn't noticed my elevated status. Better not let it get to my head!!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2016 03:47:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Different-format-for-matching-two-sql-tables/m-p/314717#M68581</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-11-28T03:47:58Z</dc:date>
    </item>
    <item>
      <title>Re: Different format for matching two sql tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Different-format-for-matching-two-sql-tables/m-p/314723#M68582</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp﻿&lt;/a&gt;&amp;nbsp;you would need =left(b.id) to make sure that both strings are justified the same way.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2016 04:27:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Different-format-for-matching-two-sql-tables/m-p/314723#M68582</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-11-28T04:27:33Z</dc:date>
    </item>
    <item>
      <title>Re: Different format for matching two sql tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Different-format-for-matching-two-sql-tables/m-p/314737#M68593</link>
      <description>&lt;PRE&gt;
PG,
If b.id is character variable, the default value in it should be left align?
Of course, Add left() for make sure it happen.

&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Nov 2016 06:06:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Different-format-for-matching-two-sql-tables/m-p/314737#M68593</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-11-28T06:06:42Z</dc:date>
    </item>
    <item>
      <title>Re: Different format for matching two sql tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Different-format-for-matching-two-sql-tables/m-p/314753#M68599</link>
      <description>&lt;P&gt;Sorry I should have been more specific:&lt;/P&gt;&lt;P&gt;have1 table ID is a character $6. :&lt;/P&gt;&lt;P&gt;ID 001010&lt;/P&gt;&lt;P&gt;ID 098900&lt;/P&gt;&lt;P&gt;ID 109899&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;have2 table ID is numeric BEST12.:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;ID 1010&lt;/P&gt;&lt;P&gt;ID 98900&lt;/P&gt;&lt;P&gt;ID 109899&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The code provided did not work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2016 07:36:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Different-format-for-matching-two-sql-tables/m-p/314753#M68599</guid>
      <dc:creator>Agent1592</dc:creator>
      <dc:date>2016-11-28T07:36:20Z</dc:date>
    </item>
    <item>
      <title>Re: Different format for matching two sql tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Different-format-for-matching-two-sql-tables/m-p/314757#M68600</link>
      <description>&lt;P&gt;If only 1 is char, use input to convert that value to numeric. Or convert numeric to char using Z6 format.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Either can be applied directly on join condition. The point is make them the same.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2016 07:55:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Different-format-for-matching-two-sql-tables/m-p/314757#M68600</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-11-28T07:55:52Z</dc:date>
    </item>
  </channel>
</rss>

