<?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: Proc sql Left Join where a value isnt exact? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-Left-Join-where-a-value-isnt-exact/m-p/703851#M215708</link>
    <description>&lt;P&gt;You could try some fuzz matched FUNCTION. like spedis() complev() compgen() .........&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data table1;
input Location $ Number;
datalines;
Home 5
Store 4
work 10
Gym 3
Schools 7
Moon 8
;
run;

data table2;
input Place $;
datalines;
Home 
Work
School
Moon
;
run;
proc sql noprint;
create table Joined as 
select place, number 
from Table2 Left Join Table1
on spedis( upcase(Table2.Place) , upcase(Table1.Location) ) &amp;lt; 10;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 05 Dec 2020 11:48:04 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2020-12-05T11:48:04Z</dc:date>
    <item>
      <title>Proc sql Left Join where a value isnt exact?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-Left-Join-where-a-value-isnt-exact/m-p/703762#M215685</link>
      <description>&lt;P&gt;Working with data similar to the following&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data table1;
input Location $ Number;
datalines;
Home 5
Store 4
work 10
Gym 3
Schools 7
Moon 8
;
run;

data table2;
input Place $;
datalines;
Home 
Work
School
Moon
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I am trying to match the Place in Table 2 with the corresponding number from Table1 with a left join.&amp;nbsp; But as you can see, there is a Pluralization and Capitalization difference between the two tables.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Running this code&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
create table Joined as 
select place, number 
from Table2 Left Join Table1
on upcase(Table2.Place) = upcase(Table1.Location);
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;running this outputs&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Table1.PNG" style="width: 308px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/52306iE49105ED674A9C5C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Table1.PNG" alt="Table1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I would like School to be matched with Schools.&amp;nbsp; Is there a way in a left join to accomplish this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or disregarding all of that.&amp;nbsp; Is there an easier way to match the values of Place in Table2 with the numbers from Table1?&lt;/P&gt;</description>
      <pubDate>Sat, 05 Dec 2020 01:11:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql-Left-Join-where-a-value-isnt-exact/m-p/703762#M215685</guid>
      <dc:creator>mcook</dc:creator>
      <dc:date>2020-12-05T01:11:04Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql Left Join where a value isnt exact?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-Left-Join-where-a-value-isnt-exact/m-p/703778#M215694</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt; I would like School to be matched with Schools. &lt;/EM&gt;&lt;BR /&gt;What's the match criterion?&lt;/P&gt;</description>
      <pubDate>Sat, 05 Dec 2020 07:46:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql-Left-Join-where-a-value-isnt-exact/m-p/703778#M215694</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-12-05T07:46:51Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql Left Join where a value isnt exact?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-Left-Join-where-a-value-isnt-exact/m-p/703851#M215708</link>
      <description>&lt;P&gt;You could try some fuzz matched FUNCTION. like spedis() complev() compgen() .........&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data table1;
input Location $ Number;
datalines;
Home 5
Store 4
work 10
Gym 3
Schools 7
Moon 8
;
run;

data table2;
input Place $;
datalines;
Home 
Work
School
Moon
;
run;
proc sql noprint;
create table Joined as 
select place, number 
from Table2 Left Join Table1
on spedis( upcase(Table2.Place) , upcase(Table1.Location) ) &amp;lt; 10;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 05 Dec 2020 11:48:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql-Left-Join-where-a-value-isnt-exact/m-p/703851#M215708</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-12-05T11:48:04Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql Left Join where a value isnt exact?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-Left-Join-where-a-value-isnt-exact/m-p/703853#M215709</link>
      <description>&lt;P&gt;I'm not sure what you&amp;nbsp; mean by match criterion.&amp;nbsp; Basically I would just like pluralization to be ignored.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Dec 2020 15:02:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql-Left-Join-where-a-value-isnt-exact/m-p/703853#M215709</guid>
      <dc:creator>mcook</dc:creator>
      <dc:date>2020-12-05T15:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql Left Join where a value isnt exact?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-Left-Join-where-a-value-isnt-exact/m-p/703872#M215715</link>
      <description>&lt;P&gt;You could use the truncated equality operator (eqt, the SQL equivalent to := in the data step) :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select place, number 
from Table2 Left Join Table1
on upcase(Table2.Place) eqt upcase(Table1.Location);
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;of course, this won't make "foot" equal "feet"&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt; &lt;/P&gt;</description>
      <pubDate>Sat, 05 Dec 2020 19:31:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql-Left-Join-where-a-value-isnt-exact/m-p/703872#M215715</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2020-12-05T19:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql Left Join where a value isnt exact?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-Left-Join-where-a-value-isnt-exact/m-p/703963#M215756</link>
      <description>&lt;P&gt;Another way:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;where      upcase(Table2.PLACE)      =      upcase(Table1.LOCATION)
   or cats(upcase(Table2.PLACE),'S') =      upcase(Table1.LOCATION)
   or      upcase(Table2.PLACE)      = cats(upcase(Table1.LOCATION),'S')&lt;/LI-CODE&gt;
&lt;P&gt;Note that while stricter and closer to your requirements than the two solutions already proposed, this logic can still perform erroneous matches, such as BAS and BASS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Dec 2020 21:04:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql-Left-Join-where-a-value-isnt-exact/m-p/703963#M215756</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-12-06T21:04:36Z</dc:date>
    </item>
  </channel>
</rss>

