<?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: Prxchange to remove string up to and including a word in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prxchange-to-remove-string-up-to-and-including-a-word/m-p/674080#M36605</link>
    <description>&lt;P&gt;Can you clarify if "Trust" and "trust" is a different word?&lt;/P&gt;&lt;P&gt;e.g.&lt;/P&gt;&lt;P&gt;Case:If "trust" is a word that has to be replaced.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Before:&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; &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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; After&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Good Investments trust 12 Moon St London ---&amp;gt; 12 Moon St London&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Case:If "trust" is not&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Before:&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; &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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; After&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Good Investments trust 12 Moon St London ---&amp;gt; (nothing appears)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 03 Aug 2020 11:00:27 GMT</pubDate>
    <dc:creator>hhinohar</dc:creator>
    <dc:date>2020-08-03T11:00:27Z</dc:date>
    <item>
      <title>Prxchange to remove string up to and including a word</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prxchange-to-remove-string-up-to-and-including-a-word/m-p/674074#M36602</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I can't find any examples that help me solve my prxchange problem where I want to remove a string up to including the search term. For example, I've got "Good Investments Trust 12 Moon St London" but I want it to search on the word "Trust" and remove everything up to and including Trust, so that I just have "12 Moon St London" remaining. My attempt below returns "Trust 12 Moon St London" so I've only been successful at removing the words &lt;EM&gt;before&lt;/EM&gt; the word Trust, but it still returns the search term itself. Note that the trust names vary in length, so it might be named "Bad Trust" or "A trust with a very long name Trust." Thanks for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data address;
	infile datalines dlm=',' dsd truncover;
	input Mail_addr1 :$30. City :$10. ;
	datalines;
Good Investments Trust 12 Moon St, London
Smith Family Trust 3 Hotel St, Paris
;

data prx;
	set address;
	Address=cats(Mail_addr1, City);
	corrected_address =prxchange("s/.*?(Trust.*)/$1/",1, Address);
drop Mail_addr1 City;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Aug 2020 09:09:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prxchange-to-remove-string-up-to-and-including-a-word/m-p/674074#M36602</guid>
      <dc:creator>Buzzy_Bee</dc:creator>
      <dc:date>2020-08-03T09:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: Prxchange to remove string up to and including a word</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prxchange-to-remove-string-up-to-and-including-a-word/m-p/674077#M36603</link>
      <description>&lt;P&gt;Why not use next code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;corrected_address = &lt;SPAN&gt;substr(address,find(address,"trust","i")+5);&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 03 Aug 2020 10:21:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prxchange-to-remove-string-up-to-and-including-a-word/m-p/674077#M36603</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-08-03T10:21:51Z</dc:date>
    </item>
    <item>
      <title>Re: Prxchange to remove string up to and including a word</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prxchange-to-remove-string-up-to-and-including-a-word/m-p/674078#M36604</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/339434"&gt;@Buzzy_Bee&lt;/a&gt;: is it now and for all times secured that the word "trust" appears only once per observation? What should happen, if there is &lt;/P&gt;
&lt;PRE&gt;Trustowsky Trust 42 Trust Street, Little Rock&lt;/PRE&gt;
&lt;P&gt;in your data?&lt;/P&gt;</description>
      <pubDate>Mon, 03 Aug 2020 10:41:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prxchange-to-remove-string-up-to-and-including-a-word/m-p/674078#M36604</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2020-08-03T10:41:09Z</dc:date>
    </item>
    <item>
      <title>Re: Prxchange to remove string up to and including a word</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prxchange-to-remove-string-up-to-and-including-a-word/m-p/674080#M36605</link>
      <description>&lt;P&gt;Can you clarify if "Trust" and "trust" is a different word?&lt;/P&gt;&lt;P&gt;e.g.&lt;/P&gt;&lt;P&gt;Case:If "trust" is a word that has to be replaced.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Before:&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; &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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; After&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Good Investments trust 12 Moon St London ---&amp;gt; 12 Moon St London&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Case:If "trust" is not&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Before:&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; &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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; After&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Good Investments trust 12 Moon St London ---&amp;gt; (nothing appears)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Aug 2020 11:00:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prxchange-to-remove-string-up-to-and-including-a-word/m-p/674080#M36605</guid>
      <dc:creator>hhinohar</dc:creator>
      <dc:date>2020-08-03T11:00:27Z</dc:date>
    </item>
    <item>
      <title>Re: Prxchange to remove string up to and including a word</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prxchange-to-remove-string-up-to-and-including-a-word/m-p/674081#M36606</link>
      <description>&lt;P&gt;If you insist using prx functions, for your specific example, check next code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  adrs =  "Good Investments Trust 12 Moon St London";
  ad1  = substr(adrs,findw(adrs,"trust","i")+5);
  
  ad2  = prxchange("s/.*?(Trust.*)/$1/",1, adrs);
  prx_id= prxparse("/.*?(Trust.*)/");
  ad3  = prxchange("s/Trust/ /",1,ad2);
  put ad1 = / ad2= / ad3=;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and be aware of all previous given remarks.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Aug 2020 12:59:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prxchange-to-remove-string-up-to-and-including-a-word/m-p/674081#M36606</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-08-03T12:59:46Z</dc:date>
    </item>
    <item>
      <title>Re: Prxchange to remove string up to and including a word</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prxchange-to-remove-string-up-to-and-including-a-word/m-p/674099#M36607</link>
      <description>Better using FINDW() .</description>
      <pubDate>Mon, 03 Aug 2020 12:27:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prxchange-to-remove-string-up-to-and-including-a-word/m-p/674099#M36607</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-08-03T12:27:07Z</dc:date>
    </item>
    <item>
      <title>Re: Prxchange to remove string up to and including a word</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prxchange-to-remove-string-up-to-and-including-a-word/m-p/674113#M36608</link>
      <description>&lt;P&gt;You are right,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;, I have edited my proposed code.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Aug 2020 13:00:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prxchange-to-remove-string-up-to-and-including-a-word/m-p/674113#M36608</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-08-03T13:00:56Z</dc:date>
    </item>
    <item>
      <title>Re: Prxchange to remove string up to and including a word</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prxchange-to-remove-string-up-to-and-including-a-word/m-p/674124#M36609</link>
      <description>&lt;PRE&gt;data address;
	infile datalines dlm=',' dsd truncover;
	input Mail_addr1 :$30. City :$10. ;
	datalines;
Good Investments Trust 12 Moon St, London
Smith Family Trust 3 Hotel St, Paris
;

data prx;
	set address;
	Address=cats(Mail_addr1, City);
	corrected_address =prxchange("s/(.*)(?=\bTrust)//i",1, Address);
drop Mail_addr1 City;
run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 03 Aug 2020 13:20:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prxchange-to-remove-string-up-to-and-including-a-word/m-p/674124#M36609</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-08-03T13:20:55Z</dc:date>
    </item>
    <item>
      <title>Re: Prxchange to remove string up to and including a word</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prxchange-to-remove-string-up-to-and-including-a-word/m-p/674137#M36610</link>
      <description>&lt;P&gt;You only need to match the substring that you want to change:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;corrected_address = prxchange("s/.*\bTrust\s*//i", 1, Address);&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note The "i" suffix requests case insensitive match.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Aug 2020 14:08:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prxchange-to-remove-string-up-to-and-including-a-word/m-p/674137#M36610</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2020-08-03T14:08:31Z</dc:date>
    </item>
    <item>
      <title>Re: Prxchange to remove string up to and including a word</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prxchange-to-remove-string-up-to-and-including-a-word/m-p/674200#M36611</link>
      <description>&lt;P&gt;Hi KSharp, your version produces the same problems as mine when I run it.&lt;/P&gt;&lt;P&gt;The result is: "&lt;SPAN&gt;Trust 12 Moon St London" so it still has Trust at the front.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Aug 2020 19:34:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prxchange-to-remove-string-up-to-and-including-a-word/m-p/674200#M36611</guid>
      <dc:creator>Buzzy_Bee</dc:creator>
      <dc:date>2020-08-03T19:34:44Z</dc:date>
    </item>
    <item>
      <title>Re: Prxchange to remove string up to and including a word</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prxchange-to-remove-string-up-to-and-including-a-word/m-p/674226#M36612</link>
      <description>&lt;P&gt;Next code is not complete but is worth to run and check:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
     input adrs $50.;
cards;
Good Investments Trust 12 Moon St, London
Smith Family Trust 3 Hotel St, Paris
Trustowsky Trust 42 Trust Street, Little Rock
Good Investments trust 12 Moon St London
;
run;

data check;
    obs = _N_;
 set test;
  ad2  = prxchange("s/.*([T]|[t]rust.){1}/$1/",1,adrs);
  prx_id= prxparse("/.*(.{5})/");
  ad3  = prxchange("s/.{5}/ /",1,ad2);
  ad4  = prxchange("s/(.*)(?=\bTrust)//i",1, adrs);   
  drop prx_id;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 03 Aug 2020 23:25:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prxchange-to-remove-string-up-to-and-including-a-word/m-p/674226#M36612</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-08-03T23:25:35Z</dc:date>
    </item>
    <item>
      <title>Re: Prxchange to remove string up to and including a word</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prxchange-to-remove-string-up-to-and-including-a-word/m-p/674285#M36613</link>
      <description>&lt;P&gt;Thank you - that is the right&amp;nbsp;prxchange formula that I was trying to create.&lt;/P&gt;&lt;P&gt;I've got thousands of companies with names like "Very Amazing Investments Trust" and "Serious Lawyers Limited" so this&amp;nbsp;prxchange is exactly what I needed as I can just change the term 'Trust' to 'Limited' and then change it to any of the other company suffixes that appear in the list. Your method means I only need to change the search term once in the formula.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Aug 2020 08:05:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prxchange-to-remove-string-up-to-and-including-a-word/m-p/674285#M36613</guid>
      <dc:creator>Buzzy_Bee</dc:creator>
      <dc:date>2020-08-04T08:05:04Z</dc:date>
    </item>
    <item>
      <title>Re: Prxchange to remove string up to and including a word</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prxchange-to-remove-string-up-to-and-including-a-word/m-p/674286#M36614</link>
      <description>&lt;P&gt;Good point Andreas. I should have mentioned that trusts tend to choose sensible names where the term 'trust' only appears once in the name, such as "Brown Family Trust" rather than "A trust with a long name Trust."&lt;/P&gt;&lt;P&gt;However, there are some cases where an address is entered as "C/o The Trustees, Brown Family Trust" so it is definitely possible to see the word trust appear twice in the address.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Aug 2020 08:12:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prxchange-to-remove-string-up-to-and-including-a-word/m-p/674286#M36614</guid>
      <dc:creator>Buzzy_Bee</dc:creator>
      <dc:date>2020-08-04T08:12:42Z</dc:date>
    </item>
    <item>
      <title>Re: Prxchange to remove string up to and including a word</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prxchange-to-remove-string-up-to-and-including-a-word/m-p/674369#M36615</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt;&amp;nbsp;, may I ask how this &lt;STRONG&gt;"s/.*\bTrust\s*//i" &lt;/STRONG&gt;works? Is it just like &lt;STRONG&gt;"s/.*\bTrust\s(.*?)//i"&amp;nbsp;&lt;/STRONG&gt;?&lt;/P&gt;</description>
      <pubDate>Tue, 04 Aug 2020 14:31:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prxchange-to-remove-string-up-to-and-including-a-word/m-p/674369#M36615</guid>
      <dc:creator>whymath</dc:creator>
      <dc:date>2020-08-04T14:31:12Z</dc:date>
    </item>
    <item>
      <title>Re: Prxchange to remove string up to and including a word</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prxchange-to-remove-string-up-to-and-including-a-word/m-p/674463#M36616</link>
      <description>&lt;P&gt;Sure, here is how it reads:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;s/&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;.* &lt;/STRONG&gt;Match anything, any length&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;\bTrust&lt;/STRONG&gt; Match a word starting with Trust&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;\s* &lt;/STRONG&gt;Match any number of spaces, including none&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;// &lt;/STRONG&gt;Replace the whole matched substring (if any) with nothing&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;i&amp;nbsp; &lt;/STRONG&gt;Make the matching case-insensitive&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Aug 2020 17:21:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prxchange-to-remove-string-up-to-and-including-a-word/m-p/674463#M36616</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2020-08-04T17:21:48Z</dc:date>
    </item>
    <item>
      <title>Re: Prxchange to remove string up to and including a word</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prxchange-to-remove-string-up-to-and-including-a-word/m-p/674723#M36624</link>
      <description>Thanks you.@PGStats</description>
      <pubDate>Wed, 05 Aug 2020 13:57:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prxchange-to-remove-string-up-to-and-including-a-word/m-p/674723#M36624</guid>
      <dc:creator>whymath</dc:creator>
      <dc:date>2020-08-05T13:57:05Z</dc:date>
    </item>
  </channel>
</rss>

