<?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 with macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/764563#M242188</link>
    <description>&lt;P&gt;It worked and the only changes I need to make are (colored below):&lt;/P&gt;&lt;P&gt;%LET BAD_PART=DUPLICATE|DO NOT USE|DONOT USE|FILE|RECORD|DO NOT ISSUE|DONT USE|DE LA | DE LA | DEL | JR&lt;FONT color="#339966"&gt;&lt;STRONG&gt;$&lt;/STRONG&gt;&lt;/FONT&gt;;&lt;/P&gt;&lt;P&gt;NAMES[I] = prxchange("s/[^A-Z]/ /&lt;STRONG&gt;&lt;FONT color="#339966"&gt;i&lt;/FONT&gt;&lt;/STRONG&gt;",-1,NAMES[I]);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is the i for? Adding $ is also critical here. So I guess I always need to specify if it is string?&lt;/P&gt;&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 27 Aug 2021 20:18:35 GMT</pubDate>
    <dc:creator>GingerJJ</dc:creator>
    <dc:date>2021-08-27T20:18:35Z</dc:date>
    <item>
      <title>prxchange with macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/762910#M241575</link>
      <description>&lt;P&gt;%LET BAD_PART=DUPLICATE|DO NOT USE|DONOT USE|FILE|RECORD|DO NOT ISSUE|DONT USE;&lt;BR /&gt;&lt;BR /&gt;DATA test1a;&lt;BR /&gt;SET test1;&lt;BR /&gt;ARRAY ORIGINAL [*] $ 40 C_LN C_FN;&lt;/P&gt;&lt;P&gt;ARRAY NAMES[*] $ 40 LN FN ;&lt;BR /&gt;DO I = 1 to 2;&lt;BR /&gt;NAMES [I]= ORIGINAL [I];&lt;BR /&gt;&lt;BR /&gt;END;&lt;BR /&gt;DO I = 1 to 2;&lt;BR /&gt;/* turn anything that is NOT a letter into space*/&lt;BR /&gt;NAMES[I] = prxchange("s/[^A-Z]/ /",-1,NAMES[I]);&lt;BR /&gt;NAMES[I] = prxchange("s/"&amp;amp;BAD_PART"/ /",-1, left(trim(NAMES[I])));&lt;BR /&gt;NAMES[I] = STRIP(NAMES[I]);/*removing all front and back space*/&lt;BR /&gt;NAMES[I] = COMPBL(NAMES[I]); /*Change multiple blanks into one*/;&lt;BR /&gt;&lt;BR /&gt;END;&lt;BR /&gt;DROP I;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It won't run. Can someone help me?&lt;/P&gt;&lt;P&gt;Thank you!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/281770"&gt;@maguiremq&lt;/a&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 18:21:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/762910#M241575</guid>
      <dc:creator>GingerJJ</dc:creator>
      <dc:date>2021-08-20T18:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: prxchange with macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/762911#M241576</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/393829"&gt;@GingerJJ&lt;/a&gt;, good to see you again.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What does your test1 dataset look like? I would need to see what's going on there before I or anyone else can help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you can, please provide it in a DATALINES statement so that we can reproduce it on our computers. We usually don't like downloading things due to potential risks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit: What happens when you remove the double quotes around &amp;amp;bad_part.?&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Michael&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 18:32:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/762911#M241576</guid>
      <dc:creator>maguiremq</dc:creator>
      <dc:date>2021-08-20T18:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: prxchange with macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/762923#M241583</link>
      <description>&lt;P&gt;Thanks for getting back to me so quick.&lt;/P&gt;&lt;P&gt;It got rid of all the error messages after I remove the "" around &amp;amp;BAD_PART. But, it didn't get rid of the bad parts at all.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dataline;&lt;/P&gt;&lt;P&gt;C_LN&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;C_FN&lt;/P&gt;&lt;P&gt;DUPLICATE-DO NOT USE&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; John234&lt;BR /&gt;DO NOT USE (DUPLICATE)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DUPLICATE RECORD&lt;BR /&gt;DO NOT USE DUPLICATE FILE&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [DONOT USE]&lt;BR /&gt;DUPLICATE FILE DUPLICATE FILE&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'DONT USE'&lt;BR /&gt;&amp;nbsp;(DUPLICATE)&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; "DUPLICATE"&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 19:13:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/762923#M241583</guid>
      <dc:creator>GingerJJ</dc:creator>
      <dc:date>2021-08-20T19:13:39Z</dc:date>
    </item>
    <item>
      <title>Re: prxchange with macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/762937#M241590</link>
      <description>&lt;P&gt;Okay, and what do you want it to look like?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, here's how you'd post it to us to make things easier:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test1;
infile datalines delimiter = "," truncover;
input c_ln :$50. c_fn :$50.;
datalines;
DUPLICATE-DO NOT USE, John234
DO NOT USE (DUPLICATE), DUPLICATE RECORD
DO NOT USE DUPLICATE FILE, [DONOT USE]
DUPLICATE FILE DUPLICATE FILE, 'DONT USE'
(DUPLICATE),"DUPLICATE"
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Aug 2021 19:31:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/762937#M241590</guid>
      <dc:creator>maguiremq</dc:creator>
      <dc:date>2021-08-20T19:31:16Z</dc:date>
    </item>
    <item>
      <title>Re: prxchange with macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/762939#M241591</link>
      <description>&lt;P&gt;I want turn everything in the BAD_PART into a space.&lt;/P&gt;&lt;P&gt;But first I want to turn all the special characters and numbers into space.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 19:32:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/762939#M241591</guid>
      <dc:creator>GingerJJ</dc:creator>
      <dc:date>2021-08-20T19:32:42Z</dc:date>
    </item>
    <item>
      <title>Re: prxchange with macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/762945#M241593</link>
      <description>&lt;P&gt;Here's part 1:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let bad_part2 = %sysfunc(tranwrd(&amp;amp;bad_part., %str(|), %str( )));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt; %put &amp;amp;bad_part2.;
DUPLICATE DO NOT USE DONOT USE FILE RECORD DO NOT ISSUE DONT USE
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
	set test1;
		c_ln_1 = prxchange("s/[^A-Za-z]+/ /", -1, trim(c_ln));
		c_fn_1 = prxchange("s/[^A-Za-z]+/ /", -1, trim(c_fn));
run;

proc print data = want;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Print: Data Set WORK.WANT" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="r header" scope="col"&gt;Obs&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;c_ln&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;c_fn&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;c_ln_1&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;c_fn_1&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;1&lt;/TH&gt;
&lt;TD class="l data"&gt;DUPLICATE-DO NOT USE&lt;/TD&gt;
&lt;TD class="l data"&gt;John234&lt;/TD&gt;
&lt;TD class="l data"&gt;DUPLICATE DO NOT USE&lt;/TD&gt;
&lt;TD class="l data"&gt;John&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;2&lt;/TH&gt;
&lt;TD class="l data"&gt;DO NOT USE (DUPLICATE)&lt;/TD&gt;
&lt;TD class="l data"&gt;DUPLICATE RECORD&lt;/TD&gt;
&lt;TD class="l data"&gt;DO NOT USE DUPLICATE&lt;/TD&gt;
&lt;TD class="l data"&gt;DUPLICATE RECORD&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;3&lt;/TH&gt;
&lt;TD class="l data"&gt;DO NOT USE DUPLICATE FILE&lt;/TD&gt;
&lt;TD class="l data"&gt;[DONOT USE]&lt;/TD&gt;
&lt;TD class="l data"&gt;DO NOT USE DUPLICATE FILE&lt;/TD&gt;
&lt;TD class="l data"&gt;DONOT USE&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;4&lt;/TH&gt;
&lt;TD class="l data"&gt;DUPLICATE FILE DUPLICATE FILE&lt;/TD&gt;
&lt;TD class="l data"&gt;'DONT USE'&lt;/TD&gt;
&lt;TD class="l data"&gt;DUPLICATE FILE DUPLICATE FILE&lt;/TD&gt;
&lt;TD class="l data"&gt;DONT USE&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;5&lt;/TH&gt;
&lt;TD class="l data"&gt;(DUPLICATE)&lt;/TD&gt;
&lt;TD class="l data"&gt;"DUPLICATE"&lt;/TD&gt;
&lt;TD class="l data"&gt;DUPLICATE&lt;/TD&gt;
&lt;TD class="l data"&gt;DUPLICATE&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 19:48:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/762945#M241593</guid>
      <dc:creator>maguiremq</dc:creator>
      <dc:date>2021-08-20T19:48:27Z</dc:date>
    </item>
    <item>
      <title>Re: prxchange with macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/762950#M241594</link>
      <description>&lt;P&gt;Got it! Will do in the future!&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 19:51:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/762950#M241594</guid>
      <dc:creator>GingerJJ</dc:creator>
      <dc:date>2021-08-20T19:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: prxchange with macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/762953#M241596</link>
      <description>&lt;P&gt;Sorry I didn't make myself clear.&amp;nbsp;&lt;/P&gt;&lt;P&gt;%LET BAD_PART=DUPLICATE|DO NOT USE|DONOT USE|FILE|RECORD|DO NOT ISSUE|DONT USE;&lt;/P&gt;&lt;P&gt;I want to get rid of all the phrases in BAD_PART and turn that into a single space.&lt;/P&gt;&lt;P&gt;eg. turn "DUPLICATE John" into "&amp;nbsp; John"&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 19:55:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/762953#M241596</guid>
      <dc:creator>GingerJJ</dc:creator>
      <dc:date>2021-08-20T19:55:04Z</dc:date>
    </item>
    <item>
      <title>Re: prxchange with macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/762957#M241599</link>
      <description>&lt;P&gt;So is John the only thing left?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
	set test1;
		c_ln_1 = prxchange("s/[^A-Za-z]+/ /", -1, trim(c_ln));
		c_fn_1 = prxchange("s/[^A-Za-z]+/ /", -1, trim(c_fn));
		c_ln_2 = prxchange("s/(&amp;amp;bad_part.)/ /", -1, trim(c_ln_1));
		c_fn_2 = prxchange("s/(&amp;amp;bad_part.)/ /", -1, trim(c_fn_1));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Aug 2021 20:02:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/762957#M241599</guid>
      <dc:creator>maguiremq</dc:creator>
      <dc:date>2021-08-20T20:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: prxchange with macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/762958#M241600</link>
      <description>&lt;P&gt;It fixed it!&lt;/P&gt;&lt;P&gt;Thank you so much!&lt;/P&gt;&lt;PRE class="language-sas"&gt;&lt;CODE&gt;c_ln_1 = prxchange("s/[^A-Za-z]+/ /", -1, trim(c_ln));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;What is the "+" for in the above statement?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 20:06:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/762958#M241600</guid>
      <dc:creator>GingerJJ</dc:creator>
      <dc:date>2021-08-20T20:06:13Z</dc:date>
    </item>
    <item>
      <title>Re: prxchange with macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/762961#M241601</link>
      <description>&lt;P&gt;The plus is considered a 'greedy match'. It takes however many combinations of whatever you're requesting. If it finds one character, it will keep that one character. If there are two, it will keep those two. If there are 90, it will keep 90.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 20:14:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/762961#M241601</guid>
      <dc:creator>maguiremq</dc:creator>
      <dc:date>2021-08-20T20:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: prxchange with macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/762964#M241603</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/281770"&gt;@maguiremq&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;The plus is considered a 'greedy match'. It takes however many combinations of whatever you're requesting. If it finds one character, it will keep that one character. If there are two, it will keep those two. If there are 90, it will keep 90.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That is more complicated explanation than I would have expected.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;+ means match 1 or more.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;* means match 0 or more.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you mentioned greedy match what would be the way to do a non-greedy match?&amp;nbsp; I don't think there is one for this example but perhaps you could provide a better example that demonstrates a non-greedy match and explain the RegEx symbols needed for that.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 20:27:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/762964#M241603</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-08-20T20:27:21Z</dc:date>
    </item>
    <item>
      <title>Re: prxchange with macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/762966#M241604</link>
      <description>&lt;P&gt;I don't understand how the macro processor comes into this.&lt;/P&gt;
&lt;P&gt;Your RegEx code is running in a data step.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 20:30:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/762966#M241604</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-08-20T20:30:58Z</dc:date>
    </item>
    <item>
      <title>Re: prxchange with macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/762967#M241605</link>
      <description>&lt;P&gt;NAMES[I] = prxchange("s/[^A-Z]/ /",-1,trim(NAMES[I]));&lt;/P&gt;&lt;P&gt;The above code also serves the purpose without the "+". So when is it absolutely necessary to add the "+"?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 20:33:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/762967#M241605</guid>
      <dc:creator>GingerJJ</dc:creator>
      <dc:date>2021-08-20T20:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: prxchange with macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/762972#M241607</link>
      <description>&lt;P&gt;Try it and see if there is a difference.&lt;/P&gt;
&lt;P&gt;Look carefully at how many spaces are used to replace the non uppercase letters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt; 69         data test;
 70          x='AbcdFGHxyz';
 71          x2 = prxchange("s/[^A-Z]/ /",-1,x);
 72          x3 = prxchange("s/[^A-Z]+/ /",-1,x);
 73          put (_all_) (=:$quote./);
 74         run;
 
 x="AbcdFGHxyz"
 x2="A   FGH"
 x3="A FGH"&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 20:40:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/762972#M241607</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-08-20T20:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: prxchange with macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/763151#M241671</link>
      <description>No, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;, you're completely right. I don't know what I was thinking that day. Must have been the end-of-workweek blues.</description>
      <pubDate>Sun, 22 Aug 2021 12:29:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/763151#M241671</guid>
      <dc:creator>maguiremq</dc:creator>
      <dc:date>2021-08-22T12:29:18Z</dc:date>
    </item>
    <item>
      <title>Re: prxchange with macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/763174#M241683</link>
      <description>&lt;P&gt;This is all you need:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;NAMES[I] = prxchange("s/&amp;amp;BAD_PART|[^A-Z]+/ /", -1, trim(NAMES[I]));
NAMES[I] = left(compbl(NAMES[I])); 
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The + and the trim() serve no purpose but to improve performance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Aug 2021 00:30:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/763174#M241683</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-08-23T00:30:20Z</dc:date>
    </item>
    <item>
      <title>Re: prxchange with macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/763563#M241832</link>
      <description>&lt;P&gt;Thank you all that helped!&lt;/P&gt;&lt;P&gt;I'm really touched by so much support here!&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 15:05:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/763563#M241832</guid>
      <dc:creator>GingerJJ</dc:creator>
      <dc:date>2021-08-24T15:05:33Z</dc:date>
    </item>
    <item>
      <title>Re: prxchange with macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/764523#M242170</link>
      <description>&lt;P&gt;&lt;BR /&gt;%LET BAD_PART=DUPLICATE|DO NOT USE|DONOT USE|FILE|RECORD|DO NOT ISSUE|DONT USE|DE LA | DE LA | DEL | JR|;&lt;/P&gt;&lt;P&gt;data test1;&lt;BR /&gt;infile datalines delimiter = "," truncover;&lt;BR /&gt;input c_ln :$50. c_fn :$50.;&lt;BR /&gt;datalines;&lt;BR /&gt;DUPLICATE-DO NOT USE, JOHN234&lt;BR /&gt;DO NOT USE (DUPLICATE), DUPLICATE RECORD&lt;BR /&gt;DO NOT USE DUPLICATE FILE, [DONOT USE]&lt;BR /&gt;DUPLICATE FILE DUPLICATE FILE, 'DONT USE'&lt;BR /&gt;(DUPLICATE),"DUPLICATE"&lt;BR /&gt;DE LA MARIA, MARIA JR.&lt;BR /&gt;MARIA DEL ROSA, MARIA DELROSA&lt;BR /&gt;MARIA DE LA ROSA, MARIA LAROSA&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;DATA test1a;&lt;BR /&gt;SET test1;&lt;BR /&gt;ARRAY ORIGINAL [*] $ 40 C_LN C_FN;&lt;/P&gt;&lt;P&gt;ARRAY NAMES[*] $ 40 LN FN ;&lt;BR /&gt;DO I = 1 to 2;&lt;BR /&gt;NAMES [I]= ORIGINAL [I];&lt;BR /&gt;&lt;BR /&gt;END;&lt;BR /&gt;DO I = 1 to 2;&lt;BR /&gt;/* turn anything that is NOT a letter into space*/&lt;BR /&gt;NAMES[I] = prxchange("s/[^A-Z]/ /",-1,NAMES[I]);&lt;BR /&gt;NAMES[I] = prxchange("s/&amp;amp;BAD_PART/ /",-1, left(trim(NAMES[I])));&lt;BR /&gt;NAMES[I] = STRIP(NAMES[I]);&lt;BR /&gt;NAMES[I] = COMPBL(NAMES[I]);&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;END;&lt;BR /&gt;DROP I;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The results for the last two lines are:&lt;/P&gt;&lt;P&gt;M A R I A R O S A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;M A R I A D E L R O S A&lt;BR /&gt;M A R I A R O S A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;M A R I A L A R O S A&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I still want a space after getting rid of "DE LA" or "DEL" if they are in the middle of the names.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Aug 2021 17:44:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/764523#M242170</guid>
      <dc:creator>GingerJJ</dc:creator>
      <dc:date>2021-08-27T17:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: prxchange with macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/764543#M242177</link>
      <description>&lt;P&gt;Actually, there is a space in between each letter for some reason...&lt;/P&gt;&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/281770"&gt;@maguiremq&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Aug 2021 18:46:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prxchange-with-macro/m-p/764543#M242177</guid>
      <dc:creator>GingerJJ</dc:creator>
      <dc:date>2021-08-27T18:46:17Z</dc:date>
    </item>
  </channel>
</rss>

