<?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: How do I remove a list of words from a variable? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-remove-a-list-of-words-from-a-variable/m-p/731559#M227882</link>
    <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;, yes you are partially right on the bad example. Its not that i need to trim everything before word MERCHANT, but what ever i define in the remove list should be removed from the &lt;STRONG&gt;Have&lt;/STRONG&gt; dataset. Few more example as below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;data have;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;input transaction &amp;amp; $100.;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;cards;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;INTERNET BANKING FUNDS TFER TRANSFER REF:NNN FROM A/C:NNNNNN&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;EFTPOS COSTCO WHOLESALE COUNTRY SUBURB COUNTRY&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;data remove_list;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;input rule_id &amp;amp; $100.;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;cards;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;INTERNET BANKING FUNDS TFER&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;EFTPOS&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;COUNTRY SUBURB COUNTRY&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#008000"&gt;data want;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#008000"&gt;input transaction &amp;amp; $100.;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#008000"&gt;cards;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#008000"&gt;TRANSFER REF:NNN FROM A/C:NNNNNN&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#008000"&gt;COSTCO WHOLESALE&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#008000"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 06 Apr 2021 10:59:21 GMT</pubDate>
    <dc:creator>aj34321</dc:creator>
    <dc:date>2021-04-06T10:59:21Z</dc:date>
    <item>
      <title>How do I remove a list of words from a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-remove-a-list-of-words-from-a-variable/m-p/731552#M227877</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;I have this dataset and would like to remove the words defined in remove_list. Not sure how do i handle multiple words. If this was a single word each line with array I can remove but this one is kind of confusing me.&amp;nbsp;Appreciate if someone can help me on this please. Thanks a lot...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;data have;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;input transaction &amp;amp; $100.;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;cards;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;VISA DEBIT PURCHASE CARD 8013 MERCHANT_A AREA1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;VISA DEBIT PURCHASE CARD 8013 MERCHANT_B&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;VISA DEBIT PURCHASE CARD 4059 MERCHANT_X AREA10 2271&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;VISA DEBIT PURCHASE CARD 7005 MERCHANT_Y &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;VISA DEBIT PURCHASE CARD 6008 MERCHANT_Y AREA100 57898&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;VISA DEBIT PURCHASE CARD 4095 MERCHANT_X&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;VISA DEBIT PURCHASE CARD 4095 MERCHANT_Z AREA1 AREA1 &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;VISA DEBIT PURCHASE CARD 4095 MERCHANT_Z MERCHANT_Z&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;data remove_list;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;input rule_id &amp;amp; $100.;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;cards;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;VISA DEBIT PURCHASE CARD 8013 &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;VISA DEBIT PURCHASE CARD 4059 &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;VISA DEBIT PURCHASE CARD 7005 &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;VISA DEBIT PURCHASE CARD 6008 &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;VISA DEBIT PURCHASE CARD 4095&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#008000"&gt;data want;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#008000"&gt;input transaction &amp;amp; $100.;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#008000"&gt;cards;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#008000"&gt;MERCHANT_A AREA1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#008000"&gt;MERCHANT_B&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#008000"&gt;MERCHANT_X AREA10 2271&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#008000"&gt;MERCHANT_Y&amp;nbsp;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#008000"&gt;MERCHANT_Y AREA100 57898&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#008000"&gt;MERCHANT_X&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#008000"&gt;MERCHANT_Z AREA1 AREA1&amp;nbsp;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#008000"&gt;MERCHANT_Z MERCHANT_Z&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#008000"&gt;;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I found the below code from&amp;nbsp;&lt;A href="https://communities.sas.com/t5/New-SAS-User/How-do-I-remove-a-list-of-words-from-a-string-using-a-macro/td-p/620946" target="_blank"&gt;https://communities.sas.com/t5/New-SAS-User/How-do-I-remove-a-list-of-words-from-a-string-using-a-macro/td-p/620946&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;and tried to modify but the scan function in here looks for every single word with a space seperator but in my case the rule is to remove a line of 1+ words.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data md3;&lt;BR /&gt;if _n_=1 then do;&lt;BR /&gt;if 0 then set remove_list;&lt;BR /&gt;dcl hash H (dataset:'remove_list') ;&lt;BR /&gt;h.definekey ("rule_id") ;&lt;BR /&gt;h.definedone () ;&lt;BR /&gt;end;&lt;/P&gt;
&lt;P&gt;set md2;&lt;BR /&gt;length description_3 $100;&lt;BR /&gt;do _n_= 1 to countw(description_2,' ');&lt;BR /&gt;if h.check(key:scan(description_2, _n_, ' ')) = 0 then continue;&lt;BR /&gt;description_3 = catx(' ',description_3, scan(description_2, _n_, ' '));&lt;BR /&gt;end;&lt;BR /&gt;&amp;nbsp;drop rule_id;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Apr 2021 10:33:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-remove-a-list-of-words-from-a-variable/m-p/731552#M227877</guid>
      <dc:creator>aj34321</dc:creator>
      <dc:date>2021-04-06T10:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do I remove a list of words from a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-remove-a-list-of-words-from-a-variable/m-p/731554#M227879</link>
      <description>&lt;P&gt;It looks like you want to remove everything to the left of MERCHANT, which is simple to do. Is that a good summary of the problem? Or did you provide a poor example that doesn't illustrate the real problem?&lt;/P&gt;</description>
      <pubDate>Tue, 06 Apr 2021 10:46:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-remove-a-list-of-words-from-a-variable/m-p/731554#M227879</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-04-06T10:46:42Z</dc:date>
    </item>
    <item>
      <title>Re: How do I remove a list of words from a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-remove-a-list-of-words-from-a-variable/m-p/731559#M227882</link>
      <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;, yes you are partially right on the bad example. Its not that i need to trim everything before word MERCHANT, but what ever i define in the remove list should be removed from the &lt;STRONG&gt;Have&lt;/STRONG&gt; dataset. Few more example as below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;data have;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;input transaction &amp;amp; $100.;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;cards;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;INTERNET BANKING FUNDS TFER TRANSFER REF:NNN FROM A/C:NNNNNN&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;EFTPOS COSTCO WHOLESALE COUNTRY SUBURB COUNTRY&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;data remove_list;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;input rule_id &amp;amp; $100.;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;cards;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;INTERNET BANKING FUNDS TFER&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;EFTPOS&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;COUNTRY SUBURB COUNTRY&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#008000"&gt;data want;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#008000"&gt;input transaction &amp;amp; $100.;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#008000"&gt;cards;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#008000"&gt;TRANSFER REF:NNN FROM A/C:NNNNNN&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#008000"&gt;COSTCO WHOLESALE&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#008000"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Apr 2021 10:59:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-remove-a-list-of-words-from-a-variable/m-p/731559#M227882</guid>
      <dc:creator>aj34321</dc:creator>
      <dc:date>2021-04-06T10:59:21Z</dc:date>
    </item>
    <item>
      <title>Re: How do I remove a list of words from a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-remove-a-list-of-words-from-a-variable/m-p/731561#M227883</link>
      <description>&lt;P&gt;In data set REMOVE_LIST, do we remove individual words (separated by spaces) whenever such a word is found in data set HAVE? Or does REMOVE_LIST contain phrases that are removed from data set HAVE when the &lt;STRONG&gt;entire phrase&lt;/STRONG&gt; is found in HAVE?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead of us going through this process of asking for clarification multiple times, can you write a clear and complete problem description?&lt;/P&gt;</description>
      <pubDate>Tue, 06 Apr 2021 11:03:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-remove-a-list-of-words-from-a-variable/m-p/731561#M227883</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-04-06T11:03:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do I remove a list of words from a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-remove-a-list-of-words-from-a-variable/m-p/731563#M227885</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry for that... Basically My task is to clean the transaction lines. My ultimate goal is to keep only the merchant names in the transaction string and hence i want to remove all these unwanted phrases. So basically, which ever transaction line finds this entire phrase as defined in my remove list should be removed from the transaction variable in the HAVE dataset. I dont want to break them by each single word as couple of other phrases might have post code and in removing number separatelly there are chances that some other wanted number might have gone. So which I decided to create this removal parameter list which should be looked for as a whole phrase and if found then remove it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;VISA DEBIT PURCHASE CARD 8013&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;VISA DEBIT PURCHASE CARD 4059&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;VISA DEBIT PURCHASE CARD 7005&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;VISA DEBIT PURCHASE CARD 6008&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;VISA DEBIT PURCHASE CARD 4095&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;INTERNET BANKING FUNDS TFER&lt;BR /&gt;EFTPOS&lt;BR /&gt;COUNTRY SUBURB COUNTRY&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And so is the below result after removing all the phrases from the HAVE dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#008000"&gt;MERCHANT_A AREA1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#008000"&gt;MERCHANT_B&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#008000"&gt;MERCHANT_X AREA10 2271&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#008000"&gt;MERCHANT_Y&amp;nbsp;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#008000"&gt;MERCHANT_Y AREA100 57898&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#008000"&gt;MERCHANT_X&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#008000"&gt;MERCHANT_Z AREA1 AREA1&amp;nbsp;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#008000"&gt;MERCHANT_Z MERCHANT_Z&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#008000"&gt;TRANSFER REF:NNN FROM A/C:NNNNNN&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#008000"&gt;COSTCO WHOLESALE&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope I was able to explain you in a much better way.....&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks mate..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Rgds,&lt;/P&gt;
&lt;P&gt;AK&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Apr 2021 11:11:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-remove-a-list-of-words-from-a-variable/m-p/731563#M227885</guid>
      <dc:creator>aj34321</dc:creator>
      <dc:date>2021-04-06T11:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do I remove a list of words from a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-remove-a-list-of-words-from-a-variable/m-p/731568#M227887</link>
      <description>&lt;P&gt;Load the phrases into a temporary array, and loop over that:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input transaction &amp;amp; $100.;
cards;
VISA DEBIT PURCHASE CARD 8013 MERCHANT_A AREA1
VISA DEBIT PURCHASE CARD 8013 MERCHANT_B
VISA DEBIT PURCHASE CARD 4059 MERCHANT_X AREA10 2271
VISA DEBIT PURCHASE CARD 7005 MERCHANT_Y 
VISA DEBIT PURCHASE CARD 6008 MERCHANT_Y AREA100 57898
VISA DEBIT PURCHASE CARD 4095 MERCHANT_X
VISA DEBIT PURCHASE CARD 4095 MERCHANT_Z AREA1 AREA1 
VISA DEBIT PURCHASE CARD 4095 MERCHANT_Z MERCHANT_Z
INTERNET BANKING FUNDS TFER TRANSFER REF:NNN FROM A/C:NNNNNN
EFTPOS COSTCO WHOLESALE COUNTRY SUBURB COUNTRY
;

data remove_list;
input rule_id &amp;amp; $100.;
cards;
VISA DEBIT PURCHASE CARD 8013 
VISA DEBIT PURCHASE CARD 4059 
VISA DEBIT PURCHASE CARD 7005 
VISA DEBIT PURCHASE CARD 6008 
VISA DEBIT PURCHASE CARD 4095
INTERNET BANKING FUNDS TFER
EFTPOS
COUNTRY SUBURB COUNTRY
;

proc sql noprint;
select nobs into :nobs
from dictionary.tables
where libname = "WORK" and memname = "REMOVE_LIST";
quit;

data want;
set have;
array lookup {&amp;amp;nobs.} $100 _temporary_;
if _n_ = 1
then do i = 1 to &amp;amp;nobs.;
  set remove_list;
  lookup{i} = rule_id;
end;
do i = 1 to &amp;amp;nobs.;
  pos = index(transaction,strip(lookup{i}));
  if pos
  then do;
    if pos &amp;gt; 1
    then transaction =
      substr(transaction,1,pos-1) !!
      substr(transaction,pos + length(lookup{i}))
    ;
    else transaction = substr(transaction,length(lookup{i})+1);
  end;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Apr 2021 11:41:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-remove-a-list-of-words-from-a-variable/m-p/731568#M227887</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-04-06T11:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: How do I remove a list of words from a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-remove-a-list-of-words-from-a-variable/m-p/731569#M227888</link>
      <description>&lt;P&gt;Using the example in your earlier reply&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input transaction &amp;amp; $100.;
cards;
INTERNET BANKING FUNDS TFER TRANSFER REF:NNN FROM A/C:NNNNNN
EFTPOS COSTCO WHOLESALE COUNTRY SUBURB COUNTRY
;


data remove_list;
input rule_id &amp;amp; $100.;
cards;
INTERNET BANKING FUNDS TFER
EFTPOS
COUNTRY SUBURB COUNTRY
;

proc sql;
    select distinct strip(rule_id) into :removes separated by ',' from remove_list;
quit;
%put &amp;amp;=removes;

data want;
    set have;
    do i=1 to countw("&amp;amp;removes",',');
        this_remove=scan("&amp;amp;removes",i,',');
        where=find(transaction,this_remove,'it');
        if where&amp;gt;0 then substr(transaction,where,length(this_remove))='';
        transaction=strip(transaction);
        if i=countw("&amp;amp;removes",',') then output;
    end;
    drop i this_remove where;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Apr 2021 11:47:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-remove-a-list-of-words-from-a-variable/m-p/731569#M227888</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-04-06T11:47:50Z</dc:date>
    </item>
    <item>
      <title>Re: How do I remove a list of words from a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-remove-a-list-of-words-from-a-variable/m-p/731572#M227890</link>
      <description>Thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;.. This one worked as charm... Thanks a lot. You are a GEM !!</description>
      <pubDate>Tue, 06 Apr 2021 12:02:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-remove-a-list-of-words-from-a-variable/m-p/731572#M227890</guid>
      <dc:creator>aj34321</dc:creator>
      <dc:date>2021-04-06T12:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do I remove a list of words from a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-remove-a-list-of-words-from-a-variable/m-p/731579#M227893</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input transaction &amp;amp; $100.;
cards;
INTERNET BANKING FUNDS TFER TRANSFER REF:NNN FROM A/C:NNNNNN
EFTPOS COSTCO WHOLESALE COUNTRY SUBURB COUNTRY
;


data remove_list;
input rule_id &amp;amp; $100.;
cards;
INTERNET BANKING FUNDS TFER
EFTPOS
COUNTRY SUBURB COUNTRY
;

options noquotelenmax;
proc sql noprint;
select rule_id into :t separated by '|'
 from remove_list;
quit;

%put &amp;amp;t ;

data want1;
 set have;
want=prxchange("s/\b(&amp;amp;t)\b//oi",-1, transaction);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Apr 2021 12:33:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-remove-a-list-of-words-from-a-variable/m-p/731579#M227893</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-04-06T12:33:06Z</dc:date>
    </item>
  </channel>
</rss>

