<?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: Loop over multiple datasets to perform text matching in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Loop-over-multiple-datasets-to-perform-text-matching/m-p/729714#M227151</link>
    <description>&lt;P&gt;Thanks Andreas, still a Fluorite so much to be desired from my posts I am sure.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In theory they should be and you can use that assumption.&lt;/P&gt;</description>
    <pubDate>Mon, 29 Mar 2021 07:28:51 GMT</pubDate>
    <dc:creator>larsc</dc:creator>
    <dc:date>2021-03-29T07:28:51Z</dc:date>
    <item>
      <title>Loop over multiple datasets to perform text matching</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-over-multiple-datasets-to-perform-text-matching/m-p/729666#M227118</link>
      <description>&lt;P&gt;Hi SAS community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am performing text-matching using regular expression based on the values of two tables (simplified for demonstration purposes below). My issue is that I am very unsure about the best way to go about setting up my code for doing this check for matches between values of one table with values in another table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My data looks like the following:&lt;/P&gt;&lt;P&gt;Table1&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;(Have1):&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Keyword&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; Category&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Hello | Hey&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Greeting&lt;/P&gt;&lt;P&gt;Canada | America&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; North America&lt;/P&gt;&lt;P&gt;Football | Basketball&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Sports&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Date&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Comment&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;01JAN2021&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Hello, my name is larsc&lt;/P&gt;&lt;P&gt;01JAN2021&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;I live in Europe&lt;/P&gt;&lt;P&gt;01JAN2021&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;I like to watch football&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My desired output would be like:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Category&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/STRONG&gt;&lt;STRONG&gt;Comment&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Greeting&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Hello, my name is larsc&lt;/P&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; I live in Europe&lt;/P&gt;&lt;P&gt;Sports&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; I like to watch football&lt;/P&gt;&lt;P&gt;Code3&amp;nbsp; &amp;nbsp;Test3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In reality the comments are much longer than the ones given above in which the comments are written by engineers and the keywords are highly specific to the discipline.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have done very (very) little looping thus far in SAS as may be evident from my pseudocode below, and I am unsure if setting this up as a loop is the best approach for my problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In pseudocode, my current approach would be something like the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data want;
   set have1&amp;nbsp;have2;
 &amp;nbsp;&amp;nbsp;do&amp;nbsp;over&amp;nbsp;have2; *Loop through comments in second table
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;do&amp;nbsp;over&amp;nbsp;have1; *Loop over first table to check for match between comment and keyword, if match assign value of category to result
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;nbsp;prxmatch(keyword,&amp;nbsp;comment)&amp;nbsp;then&amp;nbsp;result = category;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;end;
&amp;nbsp;&amp;nbsp;&amp;nbsp;end;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully this demonstrates my issue sufficiently, but please let me know if you want me to expand on my problem. The coding is done within a User Written Code in Data Integration studio.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 06:47:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-over-multiple-datasets-to-perform-text-matching/m-p/729666#M227118</guid>
      <dc:creator>larsc</dc:creator>
      <dc:date>2021-03-29T06:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: Loop over multiple datasets to perform text matching</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-over-multiple-datasets-to-perform-text-matching/m-p/729668#M227119</link>
      <description>&lt;P&gt;Should your dataset Want have as many rows as there are in Have2? In other words: Can there be more than one match? And what should happen if there is no match?&lt;/P&gt;</description>
      <pubDate>Sun, 28 Mar 2021 22:12:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-over-multiple-datasets-to-perform-text-matching/m-p/729668#M227119</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-03-28T22:12:19Z</dc:date>
    </item>
    <item>
      <title>Re: Loop over multiple datasets to perform text matching</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-over-multiple-datasets-to-perform-text-matching/m-p/729671#M227121</link>
      <description>&lt;P&gt;Hi Patrick,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My Want dataset should have as many records as dataset Have2. If no match can be found, the record from dataset Have2 should be output with a missing Category value (i.e., no match found). Let me add a desired output table to illustrate:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table1 &lt;STRONG&gt;(Have1):&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Keyword&amp;nbsp; &amp;nbsp;Category&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Test1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Category1&lt;/P&gt;&lt;P&gt;Test2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Category2&lt;/P&gt;&lt;P&gt;Test3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Category3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table2 &lt;STRONG&gt;(Have2):&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Code&amp;nbsp; &amp;nbsp; &amp;nbsp;Comment&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Code1&amp;nbsp; &amp;nbsp;Test1&lt;/P&gt;&lt;P&gt;Code2&amp;nbsp; &amp;nbsp;Test2&lt;/P&gt;&lt;P&gt;Code3&amp;nbsp; &amp;nbsp;Test3&lt;/P&gt;&lt;P&gt;Code4&amp;nbsp; &amp;nbsp;Test4&lt;/P&gt;&lt;P&gt;Code5&amp;nbsp; &amp;nbsp;Test5&lt;/P&gt;&lt;P&gt;Code6&amp;nbsp; &amp;nbsp;Test1&lt;/P&gt;&lt;P&gt;Code7&amp;nbsp; &amp;nbsp;Test1&lt;/P&gt;&lt;P&gt;Code8&amp;nbsp; &amp;nbsp;Test2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Desired output &lt;STRONG&gt;(Want):&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Category&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/STRONG&gt;&lt;STRONG&gt;Comment&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Category1&amp;nbsp; &amp;nbsp; Test1&lt;/P&gt;&lt;P&gt;Category2&amp;nbsp; &amp;nbsp; Test2&lt;/P&gt;&lt;P&gt;Category3&amp;nbsp; &amp;nbsp; Test3&lt;/P&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;Test4&lt;/P&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;Test5&lt;/P&gt;&lt;P&gt;Category1&amp;nbsp; &amp;nbsp; Test1&lt;/P&gt;&lt;P&gt;Category1&amp;nbsp; &amp;nbsp; Test1&lt;/P&gt;&lt;P&gt;Category2&amp;nbsp; &amp;nbsp; Test2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Mar 2021 22:28:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-over-multiple-datasets-to-perform-text-matching/m-p/729671#M227121</guid>
      <dc:creator>larsc</dc:creator>
      <dc:date>2021-03-28T22:28:59Z</dc:date>
    </item>
    <item>
      <title>Re: Loop over multiple datasets to perform text matching</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-over-multiple-datasets-to-perform-text-matching/m-p/729672#M227122</link>
      <description>&lt;P&gt;One way to go would be to create an informat with the RegEx like documented &lt;A href="https://go.documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=proc&amp;amp;docsetTarget=n1jriq5xib5j45n1pwpwzk311v0p.htm&amp;amp;locale=en" target="_self"&gt;here&lt;/A&gt; or with more examples &lt;A href="https://support.sas.com/resources/papers/proceedings12/245-2012.pdf" target="_self"&gt;here&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You then can add an OTHER = " " for any case with no match.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Mar 2021 22:39:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-over-multiple-datasets-to-perform-text-matching/m-p/729672#M227122</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-03-28T22:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: Loop over multiple datasets to perform text matching</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-over-multiple-datasets-to-perform-text-matching/m-p/729690#M227134</link>
      <description>&lt;P&gt;Your pseudo-data suggests you are doing exact matches between COMMENT in HAVE2 and KEYWORD in HAVE1.&amp;nbsp; So why are you using prxmatch instead of a straightforward join in proc sql?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 04:11:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-over-multiple-datasets-to-perform-text-matching/m-p/729690#M227134</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2021-03-29T04:11:51Z</dc:date>
    </item>
    <item>
      <title>Re: Loop over multiple datasets to perform text matching</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-over-multiple-datasets-to-perform-text-matching/m-p/729710#M227147</link>
      <description>&lt;P&gt;Hey mkeintz,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry, I should have been more precise in my description. I am not actually doing exact matching between my comments and keywords, my example is oversimplified. In reality, the data looks more like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table1&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;(Have1):&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Keyword&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; Category&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Hello | Hey&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Greeting&lt;/P&gt;&lt;P&gt;Canada | America&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; North America&lt;/P&gt;&lt;P&gt;Football | Basketball&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Sports&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Date&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Comment&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;01JAN2021&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Hello, my name is larsc&lt;/P&gt;&lt;P&gt;01JAN2021&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;I live in Europe&lt;/P&gt;&lt;P&gt;01JAN2021&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;I like to watch football&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Category&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/STRONG&gt;&lt;STRONG&gt;Comment&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Greeting&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Hello, my name is larsc&lt;/P&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; I live in Europe&lt;/P&gt;&lt;P&gt;Sports&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; I like to watch football&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In reality the comments are much longer than the ones given above in which the comments are written by engineers and the keywords are highly specific to the discipline.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 06:26:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-over-multiple-datasets-to-perform-text-matching/m-p/729710#M227147</guid>
      <dc:creator>larsc</dc:creator>
      <dc:date>2021-03-29T06:26:51Z</dc:date>
    </item>
    <item>
      <title>Re: Loop over multiple datasets to perform text matching</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-over-multiple-datasets-to-perform-text-matching/m-p/729713#M227150</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/368913"&gt;@larsc&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hey mkeintz,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry, I should have been more precise in my description. I am not actually doing exact matching between my comments and keywords, my example is oversimplified. In reality, the data looks more like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Table1&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;(Have1):&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Keyword&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; Category&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Hello | Hey&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Greeting&lt;/P&gt;
&lt;P&gt;Canada | America&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; North America&lt;/P&gt;
&lt;P&gt;Football | Basketball&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Sports&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Date&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Comment&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;01JAN2021&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Hello, my name is larsc&lt;/P&gt;
&lt;P&gt;01JAN2021&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;I live in Europe&lt;/P&gt;
&lt;P&gt;01JAN2021&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;I like to watch football&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Category&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/STRONG&gt;&lt;STRONG&gt;Comment&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Greeting&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Hello, my name is larsc&lt;/P&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; I live in Europe&lt;/P&gt;
&lt;P&gt;Sports&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; I like to watch football&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In reality the comments are much longer than the ones given above in which the comments are written by engineers and the keywords are highly specific to the discipline.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Yes, you should have posted this example in the initial post as working data step.&lt;/P&gt;
&lt;P&gt;So before i start, are all words in "Keyword" unique? Meaning each word is only once in the dataset.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 07:01:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-over-multiple-datasets-to-perform-text-matching/m-p/729713#M227150</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-03-29T07:01:33Z</dc:date>
    </item>
    <item>
      <title>Re: Loop over multiple datasets to perform text matching</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-over-multiple-datasets-to-perform-text-matching/m-p/729714#M227151</link>
      <description>&lt;P&gt;Thanks Andreas, still a Fluorite so much to be desired from my posts I am sure.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In theory they should be and you can use that assumption.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 07:28:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-over-multiple-datasets-to-perform-text-matching/m-p/729714#M227151</guid>
      <dc:creator>larsc</dc:creator>
      <dc:date>2021-03-29T07:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: Loop over multiple datasets to perform text matching</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-over-multiple-datasets-to-perform-text-matching/m-p/729725#M227157</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/368913"&gt;@larsc&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thanks Andreas, still a Fluorite so much to be desired from my posts I am sure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In theory they should be and you can use that assumption.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Fine. Then follow the links posted by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 08:36:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-over-multiple-datasets-to-perform-text-matching/m-p/729725#M227157</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-03-29T08:36:07Z</dc:date>
    </item>
    <item>
      <title>Re: Loop over multiple datasets to perform text matching</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-over-multiple-datasets-to-perform-text-matching/m-p/729736#M227161</link>
      <description>&lt;P&gt;You demonstrated your data as&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My data looks like the following:&lt;/P&gt;
&lt;P&gt;Table1&lt;STRONG&gt;(Have1):&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Keyword&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; Category&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Hello | Hey&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Greeting&lt;/P&gt;
&lt;P&gt;Canada | America&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; North America&lt;/P&gt;
&lt;P&gt;Football | Basketball&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Sports&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Date&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Comment&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;01JAN2021&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Hello, my name is larsc&lt;/P&gt;
&lt;P&gt;01JAN2021&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;I live in Europe&lt;/P&gt;
&lt;P&gt;01JAN2021&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;I like to watch football&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My desired output would be like:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Category&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/STRONG&gt;&lt;STRONG&gt;Comment&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Greeting&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Hello, my name is larsc&lt;/P&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; I live in Europe&lt;/P&gt;
&lt;P&gt;Sports&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; I like to watch football&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Few clarifications needed:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Are the &lt;STRONG&gt;bold&lt;/STRONG&gt; words the variable names in your data (&lt;STRONG&gt;Keyword,&amp;nbsp;Category,&amp;nbsp;Date,&amp;nbsp;Comment)&lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;Can &lt;STRONG&gt;Keyword&amp;nbsp;&lt;/STRONG&gt;contain more then one keyword and if positive are they separated by '|' ?&lt;BR /&gt;and in case of match, shall they be written to different output observations?&lt;/LI&gt;
&lt;LI&gt;It seems that by "matching" you mean that the &lt;STRONG&gt;keyword&lt;/STRONG&gt; is present in the &lt;STRONG&gt;comment,&amp;nbsp;&lt;BR /&gt;&lt;/STRONG&gt;though maybe you need ignore case.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Suggestion:&lt;/P&gt;
&lt;P&gt;1) create a dataset with &lt;U&gt;each&lt;/U&gt; &lt;STRONG&gt;keyword&lt;/STRONG&gt; and its &lt;STRONG&gt;category&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;2) match by SQL on upcase(&lt;STRONG&gt;comment&lt;/STRONG&gt;) contains upcase(&lt;STRONG&gt;keyword&lt;/STRONG&gt;)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; as in attached code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have1;
  length keyword $15 category $20;
  infile cards dlm=',' truncover;
  input keyword $ category $;
cards;
Hello, Greeting
Hey, Greeting
Canada, North America
America, North America
Football, Sports
Basketball, Sports
; run;
data have2;
  length comment $40;
  infile cards dlm='|' truncover;
  input Date date9.  comment $;
cards;
01Jan2021| Hello, my name is larsc
01Jan2021| I live in Europe
01Jan2021| I like to watch football
; run;
proc sql;
  create table want as
  select a.category, b.comment
  from have1 a right join have2 b
/*     on index(upcase(comment),upcase(strip(keyword))) &amp;gt; 0 */
    on upcase(b.comment) contains upcase(strip(a.keyword))
;quit;
  &lt;/CODE&gt;&lt;/PRE&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, 29 Mar 2021 09:17:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-over-multiple-datasets-to-perform-text-matching/m-p/729736#M227161</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2021-03-29T09:17:57Z</dc:date>
    </item>
    <item>
      <title>Re: Loop over multiple datasets to perform text matching</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-over-multiple-datasets-to-perform-text-matching/m-p/729861#M227202</link>
      <description>&lt;P&gt;Thanks for all the replies to this topic. Unfortunately none of the answers solved my issue satisfactorily, I create a new post with a more informative description.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 19:14:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-over-multiple-datasets-to-perform-text-matching/m-p/729861#M227202</guid>
      <dc:creator>larsc</dc:creator>
      <dc:date>2021-03-29T19:14:23Z</dc:date>
    </item>
  </channel>
</rss>

