<?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: Join two tables with like in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Join-two-tables-with-like/m-p/137682#M261272</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks ! Perfect ! It's work !!!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 05 Dec 2014 08:37:56 GMT</pubDate>
    <dc:creator>olivier_guitton</dc:creator>
    <dc:date>2014-12-05T08:37:56Z</dc:date>
    <item>
      <title>Join two tables with like</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Join-two-tables-with-like/m-p/137680#M261270</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a problem, i will join two tables with a function like/*. I explain my problem, i have a table, it's my referencial and the other my table with text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table Referencial : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;two columns : duree / correspondance&lt;/P&gt;&lt;P&gt;12 years / 144&lt;/P&gt;&lt;P&gt;4 years / 48&lt;/P&gt;&lt;P&gt;2 years / 24&lt;/P&gt;&lt;P&gt;8 years / 96&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table Duration :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;two column&lt;/P&gt;&lt;P&gt;id / text&lt;/P&gt;&lt;P&gt;25158 / cat 12 years tom&lt;/P&gt;&lt;P&gt;5896 / spot and 12 years&lt;/P&gt;&lt;P&gt;4565 / 8 years anna&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;New column (my wish) :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;id / text / correspondance&lt;/P&gt;&lt;P&gt;25158 / cat 12 years tom / 144&lt;/P&gt;&lt;P&gt;5896 / spot and 12 years / 144&lt;/P&gt;&lt;P&gt;4565 / 8 years anna / 96&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I tried this (&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://support.sas.com/resources/papers/proceedings12/122-2012.pdf"&gt;http://support.sas.com/resources/papers/proceedings12/122-2012.pdf&lt;/A&gt;&lt;SPAN&gt;) but it doesn't really work. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC SQL ;&lt;/P&gt;&lt;P&gt;CREATE TABLE&lt;/P&gt;&lt;P&gt;Possible_Matches&lt;/P&gt;&lt;P&gt;AS SELECT&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;FROM Name AS n, Birthday&lt;/P&gt;&lt;P&gt;AS&lt;/P&gt;&lt;P&gt;b&lt;/P&gt;&lt;P&gt;WHERE&lt;/P&gt;&lt;P&gt;(&lt;/P&gt;&lt;P&gt;n&lt;/P&gt;&lt;P&gt;.Last =* b.Last_B OR&lt;/P&gt;&lt;P&gt;n&lt;/P&gt;&lt;P&gt;.First =* b.First_B);&lt;/P&gt;&lt;P&gt;QUIT&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With this code, if, my column text contains a 2, i will have in correspondance all number with a two, i will have : 2 lines, one with 144 (12 years) and 24 (2 years).&lt;/P&gt;&lt;P&gt;(My wish) SAS must find an equal match. If in my text we find 12 years, so we must have 144 not 24, and if we have 1 in the text, 0 match, if we have 122, 0 match, if we have 2 years = 24.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Dec 2014 07:26:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Join-two-tables-with-like/m-p/137680#M261270</guid>
      <dc:creator>olivier_guitton</dc:creator>
      <dc:date>2014-12-05T07:26:25Z</dc:date>
    </item>
    <item>
      <title>Re: Join two tables with like</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Join-two-tables-with-like/m-p/137681#M261271</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assuming I get it right , here is a solution:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data ref;&lt;BR /&gt;input duree $ &amp;amp; coresp;&lt;BR /&gt;datalines;&lt;BR /&gt;12 years&amp;nbsp; 144&lt;BR /&gt;4 years&amp;nbsp; 48&lt;BR /&gt;2 years&amp;nbsp; 24&lt;BR /&gt;8 years&amp;nbsp; 96&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt; &lt;BR /&gt;data Duration;&lt;BR /&gt;infile datalines truncover;&lt;BR /&gt;input id text $25.;&lt;BR /&gt;datalines;&lt;BR /&gt;25158 cat 12 years tom&lt;BR /&gt;5896 spot and 12 years&lt;BR /&gt;4565 8 years anna&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data duration;&lt;BR /&gt;length keyvar $ 20 numval $ 5 ;&lt;BR /&gt;set duration;&lt;BR /&gt;stringtily=substr(text,1,find(text, "years")-1);/*determine from text string until years*/&lt;BR /&gt;numval=scan(stringtily,countw(stringtily));/*get number from string determined above - my assumption is that immediately before word years are the numbers*/&lt;BR /&gt;keyvar=strip(numval) || " years";/*determine key var*/&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;select duration.id, duration.text, ref.coresp&lt;BR /&gt;from ref inner join duration on duration.keyvar=ref.duree;&lt;BR /&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Dec 2014 08:28:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Join-two-tables-with-like/m-p/137681#M261271</guid>
      <dc:creator>Loko</dc:creator>
      <dc:date>2014-12-05T08:28:27Z</dc:date>
    </item>
    <item>
      <title>Re: Join two tables with like</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Join-two-tables-with-like/m-p/137682#M261272</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks ! Perfect ! It's work !!!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Dec 2014 08:37:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Join-two-tables-with-like/m-p/137682#M261272</guid>
      <dc:creator>olivier_guitton</dc:creator>
      <dc:date>2014-12-05T08:37:56Z</dc:date>
    </item>
  </channel>
</rss>

