<?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 Removing text from specific string in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Removing-text-from-specific-string/m-p/935409#M367773</link>
    <description>&lt;P&gt;Good Evening, Please advise what is the best way to remove certain text in a string in dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example: Assignment was sent to John Smith with the reason and status as Pending&lt;/P&gt;&lt;P&gt;Assignment was sent to Peter Smith with the reason and status as Complete.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output I'm looking for is:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Assignment was sent to John Smith&lt;/P&gt;&lt;P&gt;Assignment was sent to Peter Smith&lt;/P&gt;&lt;P&gt;I want to remove all the text that appears after the name (John smith, Peter Smith) in the above examples.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
    <pubDate>Thu, 11 Jul 2024 03:46:23 GMT</pubDate>
    <dc:creator>pappusrini</dc:creator>
    <dc:date>2024-07-11T03:46:23Z</dc:date>
    <item>
      <title>Removing text from specific string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-text-from-specific-string/m-p/935409#M367773</link>
      <description>&lt;P&gt;Good Evening, Please advise what is the best way to remove certain text in a string in dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example: Assignment was sent to John Smith with the reason and status as Pending&lt;/P&gt;&lt;P&gt;Assignment was sent to Peter Smith with the reason and status as Complete.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output I'm looking for is:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Assignment was sent to John Smith&lt;/P&gt;&lt;P&gt;Assignment was sent to Peter Smith&lt;/P&gt;&lt;P&gt;I want to remove all the text that appears after the name (John smith, Peter Smith) in the above examples.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2024 03:46:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-text-from-specific-string/m-p/935409#M367773</guid>
      <dc:creator>pappusrini</dc:creator>
      <dc:date>2024-07-11T03:46:23Z</dc:date>
    </item>
    <item>
      <title>Re: Removing text from specific string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-text-from-specific-string/m-p/935414#M367775</link>
      <description>&lt;P&gt;You need to post more examples and rules you are taking account of.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input x $80.;
cards;
Assignment was sent to John Smith with the reason and status as Pending
Assignment was sent to Peter Smith with the reason and status as Complete.
;
data want;
 set have;
 pid=prxparse('/[A-Z][a-z]+\s+[A-Z][a-z]+/');
 if prxmatch(pid,x) then do;
   call prxsubstr(pid,x,p,l);
   want=substr(x,1,p+l);
 end;
 drop pid p l;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2024 06:55:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-text-from-specific-string/m-p/935414#M367775</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-07-11T06:55:33Z</dc:date>
    </item>
    <item>
      <title>Re: Removing text from specific string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-text-from-specific-string/m-p/935442#M367781</link>
      <description>&lt;P&gt;Since we don't know how many words make up the name, it's easier to use &lt;CODE class=" language-sas"&gt;with&lt;/CODE&gt; as the marker.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data HAVE;
  input WORDS $80.;
cards;
Assignment was sent to John Smith with the reason and status as Pending
Assignment was sent to Peter Smith with the reason and status as Complete.
run;
data WANT;
  set HAVE;
  WORDS2 = substr(WORDS, 1, index(WORDS, ' with'));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2024 10:57:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-text-from-specific-string/m-p/935442#M367781</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2024-07-11T10:57:22Z</dc:date>
    </item>
  </channel>
</rss>

