<?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: Find and Remove Multiple String in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Find-and-Remove-Multiple-String/m-p/394375#M11996</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/110462"&gt;@pooiwan&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Then mark the answer which you've used as the solution and not your answer to it.&lt;/P&gt;</description>
    <pubDate>Fri, 08 Sep 2017 23:10:58 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2017-09-08T23:10:58Z</dc:date>
    <item>
      <title>Find and Remove Multiple String</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Find-and-Remove-Multiple-String/m-p/393780#M11972</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a variable as 'pr_ins_name' and example :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FASHION CO (M) BHD &lt;STRONG&gt;AS OWNER, LOOP&lt;/STRONG&gt;&lt;BR /&gt;FASHION CO (M) BHD &lt;STRONG&gt;AS OWNER, LOOP INTER&lt;/STRONG&gt;&lt;BR /&gt;ABC TECHONLOGY SDN BHD &lt;STRONG&gt;AS PRINCIPAL&lt;/STRONG&gt;&lt;BR /&gt;ABD TECHONLOGY SDN BHD &lt;STRONG&gt;AS PRINCIPAL (AS MENTION&lt;/STRONG&gt;&lt;BR /&gt;FLORA &lt;STRONG&gt;LIMITED&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;FLORA LTD&lt;BR /&gt;XYZ123 SDN BHD &lt;STRONG&gt;ON THE LIFE OF LKC&lt;/STRONG&gt;&lt;BR /&gt;XYZ123 SDN BHD &lt;STRONG&gt;ON THE LIFE OF M&lt;/STRONG&gt;&lt;BR /&gt;CAPTAIN APPAREL &lt;STRONG&gt;AS HIRER AND CONTRACTOR&lt;/STRONG&gt;&lt;BR /&gt;YS ENTERPRISE &lt;STRONG&gt;AS HIRER AND HP DEVELOPMENT&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to remove those words (in Bold) :&lt;/P&gt;&lt;P&gt;1) contain "AS OWNER" , "AS PRINCIPAL" , "AS HIRER" , "ON THE LIFE OF" , "AS HIRER"&lt;/P&gt;&lt;P&gt;2) replace the "LIMITED" with "LTD"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to combine above into one statement ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#000080"&gt;data want;&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#000080"&gt;set sasuser.name;&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#000080"&gt;ins_name = substr (pr_ins_Name,1,find(pr_ins_name, ' AS OWNER')) ;&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#000080"&gt;ins_name = substr (pr_ins_Name,1,find(pr_ins_name, ' AS HIRER')) ;&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#000080"&gt;ins_name = substr (pr_ins_Name,1,find(pr_ins_name, ' AS PRINCIPAL')) ;&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#000080"&gt;ins_name = substr (pr_ins_Name,1,find(pr_ins_name, ' ON THE LIFE OF')) ;&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#000080"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#000080"&gt;run;&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#000080"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2017 08:11:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Find-and-Remove-Multiple-String/m-p/393780#M11972</guid>
      <dc:creator>pooiwan</dc:creator>
      <dc:date>2017-09-07T08:11:02Z</dc:date>
    </item>
    <item>
      <title>Re: Find and Remove Multiple String</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Find-and-Remove-Multiple-String/m-p/393791#M11974</link>
      <description>&lt;P&gt;Something like:&lt;/P&gt;
&lt;PRE&gt;data want;
  set sasuser.name;
  do i="AS_OWNER","AS PRINCIPAL"...;
    ins_name=tranwrd(ins_name,i,"");
  end;
run;
&lt;/PRE&gt;
&lt;P&gt;You could also put your strings in a dataset and use that.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2017 08:55:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Find-and-Remove-Multiple-String/m-p/393791#M11974</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-09-07T08:55:00Z</dc:date>
    </item>
    <item>
      <title>Re: Find and Remove Multiple String</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Find-and-Remove-Multiple-String/m-p/393829#M11977</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying below statement:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;set sasuser.name;&lt;BR /&gt;do i=' AS OWNER',' AS PRINCIPAL','ON THE LIFE OF',' AS HIRER';&lt;BR /&gt;ins_Name = substr (pr_ins_Name,1,find(pr_ins_name, i)) ;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Only observation contains&amp;nbsp;'AS HIRER' has executed.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="comic sans ms,sans-serif"&gt;&lt;EM&gt;Message shown :&amp;nbsp;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="comic sans ms,sans-serif"&gt;&lt;EM&gt;NOTE: Invalid third argument to function SUBSTR at line 31 column 12.&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2" color="#0000FF"&gt;FASHION CO (M) BHD&amp;nbsp;AS OWNER, LOOP&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2" color="#0000FF"&gt;FASHION CO (M) BHD&amp;nbsp;AS OWNER, LOOP INTER&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2" color="#0000FF"&gt;ABC TECHONLOGY SDN BHD&amp;nbsp;AS PRINCIPAL&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2" color="#0000FF"&gt;ABD TECHONLOGY SDN BHD&amp;nbsp;AS PRINCIPAL (AS MENTION&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2" color="#0000FF"&gt;FLORA&amp;nbsp;LIMITED&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2" color="#0000FF"&gt;FLORA LTD&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2" color="#0000FF"&gt;XYZ123 SDN BHD&amp;nbsp;ON THE LIFE OF LKC&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2" color="#0000FF"&gt;XYZ123 SDN BHD&amp;nbsp;ON THE LIFE OF M&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2" color="#0000FF"&gt;CAPTAIN APPAREL&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2" color="#0000FF"&gt;YS ENTERPRISE&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2" color="#0000FF"&gt;&lt;FONT color="#000000"&gt;Thank you.&lt;/FONT&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2017 10:58:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Find-and-Remove-Multiple-String/m-p/393829#M11977</guid>
      <dc:creator>pooiwan</dc:creator>
      <dc:date>2017-09-07T10:58:38Z</dc:date>
    </item>
    <item>
      <title>Re: Find and Remove Multiple String</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Find-and-Remove-Multiple-String/m-p/393834#M11978</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/110462"&gt;@pooiwan&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Your approach as such seems more or less to work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample;
  infile datalines truncover;
  input pr_ins_name $100.;
  pr_ins_name_orig=pr_ins_name;
  do search_str=' AS OWNER',' AS PRINCIPAL','ON THE LIFE OF',' AS HIRER';
    pr_ins_name = substr (pr_ins_name,1,find(pr_ins_name,search_str,'i'));
  end;

  datalines;
FASHION CO (M) BHD AS OWNER, LOOP
FASHION CO (M) BHD AS OWNER, LOOP INTER
ABC TECHONLOGY SDN BHD AS PRINCIPAL
ABD TECHONLOGY SDN BHD AS PRINCIPAL (AS MENTION
FLORA LIMITED
FLORA LTD
XYZ123 SDN BHD ON THE LIFE OF LKC
XYZ123 SDN BHD ON THE LIFE OF M
CAPTAIN APPAREL AS HIRER AND CONTRACTOR
YS ENTERPRISE AS HIRER AND HP DEVELOPMENT
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Capture.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/14887i6F11B22E4CCE1A84/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2017 11:13:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Find-and-Remove-Multiple-String/m-p/393834#M11978</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-09-07T11:13:19Z</dc:date>
    </item>
    <item>
      <title>Re: Find and Remove Multiple String</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Find-and-Remove-Multiple-String/m-p/393842#M11980</link>
      <description>&lt;P&gt;You do however notice that your code is different to mine yes?&lt;/P&gt;
&lt;PRE&gt;    ins_name=tranwrd(ins_name,i,"");&lt;/PRE&gt;
&lt;P&gt;And yours:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;ins_Name = substr (pr_ins_Name,1,find(pr_ins_name, i)) ;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Mine removes strings, yours does a substring.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2017 12:01:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Find-and-Remove-Multiple-String/m-p/393842#M11980</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-09-07T12:01:16Z</dc:date>
    </item>
    <item>
      <title>Re: Find and Remove Multiple String</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Find-and-Remove-Multiple-String/m-p/394088#M11992</link>
      <description>&lt;P&gt;Thank you for your assistant. The&amp;nbsp;&lt;SPAN&gt;program is worked and solved my problem. Have a nice day.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2017 01:40:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Find-and-Remove-Multiple-String/m-p/394088#M11992</guid>
      <dc:creator>pooiwan</dc:creator>
      <dc:date>2017-09-08T01:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: Find and Remove Multiple String</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Find-and-Remove-Multiple-String/m-p/394166#M11994</link>
      <description>&lt;P&gt;In future please mark the post which answered the question as the correct answer, not your thank you post. &amp;nbsp;Otherwise the answer post (which appears under the question) does not actually answer the question.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2017 09:31:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Find-and-Remove-Multiple-String/m-p/394166#M11994</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-09-08T09:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: Find and Remove Multiple String</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Find-and-Remove-Multiple-String/m-p/394375#M11996</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/110462"&gt;@pooiwan&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Then mark the answer which you've used as the solution and not your answer to it.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2017 23:10:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Find-and-Remove-Multiple-String/m-p/394375#M11996</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-09-08T23:10:58Z</dc:date>
    </item>
  </channel>
</rss>

