<?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 Extracting sentences from text in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Extracting-sentences-from-text/m-p/388723#M93223</link>
    <description>&lt;P&gt;Hi everyone&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;gave a great solusion to the probelm of extracting a sentence with keyword from a text:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data want;
 set have;
 pid=prxparse('/([^\.]|\.(?=\d))+\./o');
 start=1;stop=length(string);
 call prxnext(pid,start,stop,string,p,l);
 do while(p&amp;gt;0);
  found=substr(string,p,l);
  if find(found,'&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;keyword&lt;/STRONG&gt;&lt;/FONT&gt;','i') then output;
  call prxnext(pid,start,stop,string,p,l);
 end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Out of interest, anyinw can suggest modification to this code to also extract the sentence before the one that containes the keyword?&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Thu, 17 Aug 2017 09:28:49 GMT</pubDate>
    <dc:creator>ammarhm</dc:creator>
    <dc:date>2017-08-17T09:28:49Z</dc:date>
    <item>
      <title>Extracting sentences from text</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extracting-sentences-from-text/m-p/388723#M93223</link>
      <description>&lt;P&gt;Hi everyone&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;gave a great solusion to the probelm of extracting a sentence with keyword from a text:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data want;
 set have;
 pid=prxparse('/([^\.]|\.(?=\d))+\./o');
 start=1;stop=length(string);
 call prxnext(pid,start,stop,string,p,l);
 do while(p&amp;gt;0);
  found=substr(string,p,l);
  if find(found,'&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;keyword&lt;/STRONG&gt;&lt;/FONT&gt;','i') then output;
  call prxnext(pid,start,stop,string,p,l);
 end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Out of interest, anyinw can suggest modification to this code to also extract the sentence before the one that containes the keyword?&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2017 09:28:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extracting-sentences-from-text/m-p/388723#M93223</guid>
      <dc:creator>ammarhm</dc:creator>
      <dc:date>2017-08-17T09:28:49Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting sentences from text</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extracting-sentences-from-text/m-p/388730#M93226</link>
      <description>&lt;P&gt;Managed to solve it !&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
 set want_temp;
 pid=prxparse('/([^\.]|\.(?=\d))+\./o');
 start=1;stop=length(string);
 call prxnext(pid,start,stop,string,p,l);
 do while(p&amp;gt;0);
  found=substr(string,p,l);
  found2=substr(string,p2,l2);
  if find(found,'keyword','i') then output;
  p2=p; l2=l;
  call prxnext(pid,start,stop,string,p,l);
 end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Aug 2017 10:20:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extracting-sentences-from-text/m-p/388730#M93226</guid>
      <dc:creator>ammarhm</dc:creator>
      <dc:date>2017-08-17T10:20:07Z</dc:date>
    </item>
  </channel>
</rss>

