<?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: prxmatch syntax in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/prxmatch-syntax/m-p/421402#M103662</link>
    <description>&lt;P&gt;What is wrong with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;'s solution? You never stated what the extraction criteria are.&lt;/P&gt;
&lt;P&gt;If you have never used regular expressions, the learning curve can be steep.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 14 Dec 2017 23:01:51 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2017-12-14T23:01:51Z</dc:date>
    <item>
      <title>prxmatch syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prxmatch-syntax/m-p/420851#M103549</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have run the code (please see below)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input = "CRH PLC TO BID FOR PPC LTD";
run;

data want;

set have;

temp=input;
p=prxmatch('/\b(TO BID)\b/i',temp);

do while(p);
temp=substr(temp,p);
temp=substr(temp,findc(temp,' ')+1);
Buy=catx(' ',scan(temp,1,' '),scan(temp,2,' '),scan(temp,3,' '),scan(temp,4,' '));

p=prxmatch('/\b(TO BID)\b/i',temp);
end;

drop temp p;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;which uses an anchor word "TO BID" and brings back exactly the data I require after the anchor which is "BID FOR PPC LTD"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you happen to know how I can reverse this and take words before the&amp;nbsp;&lt;SPAN&gt;anchor word "TO BID"&amp;nbsp;? I am wanting to obtain the text "CRH PLC TO BID"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;Chris&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 15:47:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prxmatch-syntax/m-p/420851#M103549</guid>
      <dc:creator>cmoore</dc:creator>
      <dc:date>2017-12-13T15:47:13Z</dc:date>
    </item>
    <item>
      <title>Re: prxmatch syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prxmatch-syntax/m-p/420870#M103554</link>
      <description>&lt;P&gt;Or simply:&lt;/P&gt;
&lt;PRE&gt;data have;
  input="CRH PLC TO BID FOR PPC LTD";
  after=substr(input,index(input,"TO BID")+6);
  before=substr(input,1,index(input,"TO BID")+5);
run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Dec 2017 16:06:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prxmatch-syntax/m-p/420870#M103554</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-12-13T16:06:12Z</dc:date>
    </item>
    <item>
      <title>Re: prxmatch syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prxmatch-syntax/m-p/421074#M103594</link>
      <description>&lt;P&gt;How far back do you want to go?&lt;/P&gt;
&lt;P&gt;This may help:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data WANT;
  STR  = "CRH PLC TO BID FOR PPC LTD";
  WANT = prxchange('s/(.*)\bTO BID\b.*/$1/i',1,STR);
  put WANT=;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;WANT=CRH PLC&lt;/P&gt;
&lt;P&gt;Also look at the &lt;FONT face="courier new,courier"&gt;prxsubstr()&lt;/FONT&gt; function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 04:24:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prxmatch-syntax/m-p/421074#M103594</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2017-12-14T04:24:42Z</dc:date>
    </item>
    <item>
      <title>Re: prxmatch syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prxmatch-syntax/m-p/421109#M103595</link>
      <description>&lt;P&gt;Thanks for your reply. So if I wanted to go back and retrieve "&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token string"&gt;"CRH PLC TO BID"&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;and also&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token string"&gt;"BID FOR PPC LTD"&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how would I tweak the code? It's a function that I have never used before. I'll need to do some reading up around the subject.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks&lt;BR /&gt;&lt;BR /&gt;Chris&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 08:44:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prxmatch-syntax/m-p/421109#M103595</guid>
      <dc:creator>cmoore</dc:creator>
      <dc:date>2017-12-14T08:44:52Z</dc:date>
    </item>
    <item>
      <title>Re: prxmatch syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prxmatch-syntax/m-p/421402#M103662</link>
      <description>&lt;P&gt;What is wrong with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;'s solution? You never stated what the extraction criteria are.&lt;/P&gt;
&lt;P&gt;If you have never used regular expressions, the learning curve can be steep.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 23:01:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prxmatch-syntax/m-p/421402#M103662</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2017-12-14T23:01:51Z</dc:date>
    </item>
  </channel>
</rss>

