<?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: Use prxmatch to match phrase from column values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Use-prxmatch-to-match-phrase-from-column-values/m-p/842447#M333118</link>
    <description>&lt;P&gt;That fixed it, thank you for insight.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 04 Nov 2022 03:30:54 GMT</pubDate>
    <dc:creator>ABprint</dc:creator>
    <dc:date>2022-11-04T03:30:54Z</dc:date>
    <item>
      <title>Use prxmatch to match phrase from column values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-prxmatch-to-match-phrase-from-column-values/m-p/842432#M333114</link>
      <description>&lt;P&gt;I am trying to match a phrase using the prxmatch function by passing it a column value.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data long_string;
infile datalines delimiter=',';
informat txt $40. keyp1 $20. keyp2 $20. keyp3 $20. keyp4 $20.;
input txt keyp1 keyp2 keyp3 keyp4;
datalines;
That is a great way to end the day,great way,end,today,even worse
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;How can I go through the 4 keyp variables and match the phrase?&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2022 00:57:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-prxmatch-to-match-phrase-from-column-values/m-p/842432#M333114</guid>
      <dc:creator>ABprint</dc:creator>
      <dc:date>2022-11-04T00:57:57Z</dc:date>
    </item>
    <item>
      <title>Re: Use prxmatch to match phrase from column values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-prxmatch-to-match-phrase-from-column-values/m-p/842436#M333115</link>
      <description>&lt;P&gt;This seems to work:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data first_try;
set long_string;
match1 = prxmatch(catt("m/(",lowcase(keyp1),")/oi"),txt);
match2 = prxmatch(catt("m/(",lowcase(keyp2),")/oi"),txt);
match3 = prxmatch(catt("m/(",lowcase(keyp3),")/oi"),txt);
match4 = prxmatch(catt("m/(",lowcase(keyp4),")/oi"),txt);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I don't quite understand why my array is not working:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data final;
set long_string;
array keyp{4} $ keyp1-keyp4;
array match{4} match1-match4;
do i=1 to 4;
match[i] = prxmatch(catt("m/(",lowcase(keyp[i]),")/oi"),txt);
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 04 Nov 2022 02:14:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-prxmatch-to-match-phrase-from-column-values/m-p/842436#M333115</guid>
      <dc:creator>ABprint</dc:creator>
      <dc:date>2022-11-04T02:14:51Z</dc:date>
    </item>
    <item>
      <title>Re: Use prxmatch to match phrase from column values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-prxmatch-to-match-phrase-from-column-values/m-p/842443#M333116</link>
      <description>&lt;P&gt;Well for one thing, the "o" pattern suffix instructs the matching function that the pattern is a constant, i.e. that it doesn't need to be recompiled at every invocation. Which is clearly not the case here.&lt;/P&gt;
&lt;P&gt;BTW, the "i" suffix makes the matching case insensitive. So, no need for the lowcase() function call.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2022 02:35:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-prxmatch-to-match-phrase-from-column-values/m-p/842443#M333116</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2022-11-04T02:35:23Z</dc:date>
    </item>
    <item>
      <title>Re: Use prxmatch to match phrase from column values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-prxmatch-to-match-phrase-from-column-values/m-p/842447#M333118</link>
      <description>&lt;P&gt;That fixed it, thank you for insight.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2022 03:30:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-prxmatch-to-match-phrase-from-column-values/m-p/842447#M333118</guid>
      <dc:creator>ABprint</dc:creator>
      <dc:date>2022-11-04T03:30:54Z</dc:date>
    </item>
  </channel>
</rss>

