<?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: SAS compare if two strings have two or more words same in SAS Data Science</title>
    <link>https://communities.sas.com/t5/SAS-Data-Science/SAS-compare-if-two-strings-have-two-or-more-words-same/m-p/75420#M466</link>
    <description>I think you would need to use the scan function in a do loop  for string1 to parse into individual terms, then you could use substr for each term to see if it occurs in string2. It would probably be more accurate (only match complete words)  to use scan on both string1 and string2. In that case you should use a data structure like an array or hash to save the terms from string1 and then look them up for a match when your scanning string2.&lt;BR /&gt;
&lt;BR /&gt;
Russ</description>
    <pubDate>Fri, 16 Apr 2010 13:10:29 GMT</pubDate>
    <dc:creator>RussAlbright</dc:creator>
    <dc:date>2010-04-16T13:10:29Z</dc:date>
    <item>
      <title>SAS compare if two strings have two or more words same</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/SAS-compare-if-two-strings-have-two-or-more-words-same/m-p/75419#M465</link>
      <description>Hi I have a data set&lt;BR /&gt;
&lt;BR /&gt;
input string1 $char60. string2 $char60.&lt;BR /&gt;
   datalines;                                                                                                         &lt;BR /&gt;
string1=Lycanthrope&lt;BR /&gt;
string2=Luz vagaT                                      &lt;BR /&gt;
output=no match&lt;BR /&gt;
string1=When Your Heart Stops Beating      &lt;BR /&gt;
string2=When your heart stops beating        &lt;BR /&gt;
output=match&lt;BR /&gt;
string1=155 44                                           string2=155 (+44)                                      &lt;BR /&gt;
output=match&lt;BR /&gt;
string1=Come Mai 883&lt;BR /&gt;
string2=Come Mai (OcraMiX_ dj) - 883         &lt;BR /&gt;
output=match&lt;BR /&gt;
&lt;BR /&gt;
I would like SAS to output if string1 has two or more words which match with string 2 a MATCH and if there are no words matching then it should display NO MATCH.&lt;BR /&gt;
&lt;BR /&gt;
I've tried the complev, compged, SPEDIS functions and none of these seem to be able to return the desired result.

Message was edited by: celendin</description>
      <pubDate>Thu, 15 Apr 2010 13:12:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/SAS-compare-if-two-strings-have-two-or-more-words-same/m-p/75419#M465</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-04-15T13:12:25Z</dc:date>
    </item>
    <item>
      <title>Re: SAS compare if two strings have two or more words same</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/SAS-compare-if-two-strings-have-two-or-more-words-same/m-p/75420#M466</link>
      <description>I think you would need to use the scan function in a do loop  for string1 to parse into individual terms, then you could use substr for each term to see if it occurs in string2. It would probably be more accurate (only match complete words)  to use scan on both string1 and string2. In that case you should use a data structure like an array or hash to save the terms from string1 and then look them up for a match when your scanning string2.&lt;BR /&gt;
&lt;BR /&gt;
Russ</description>
      <pubDate>Fri, 16 Apr 2010 13:10:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/SAS-compare-if-two-strings-have-two-or-more-words-same/m-p/75420#M466</guid>
      <dc:creator>RussAlbright</dc:creator>
      <dc:date>2010-04-16T13:10:29Z</dc:date>
    </item>
  </channel>
</rss>

