<?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 PRX(Pearl) Functions: Metacharacter in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PRX-Pearl-Functions-Metacharacter/m-p/611295#M178145</link>
    <description>&lt;P&gt;In the below code i want to replace only the last character along with space and double quotes to some other character as below only when there is a space between the last character and double quotes .If there is no space between the last character and double quotes then it should be unchanged.If we perform this with tranwrd then it will change all the spaces and it cannot identify the last character , but PRX functions has that feasibility , but could not able to get the exact Metacharacter to perform this . Tried with Metacharacter &lt;STRONG&gt;[ ]&lt;/STRONG&gt; but how to enclose the characters , space and double quotes not sure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data have ;&lt;BR /&gt;length have $100. ;&lt;BR /&gt;have='Annual day " ';output;&lt;BR /&gt;have='Funny world " ';output;&lt;BR /&gt;have='reverse gear "';output;&lt;BR /&gt;have =' "Google aps"';output;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;No space between last character and double quotes&lt;BR /&gt;have= '" Android application"';output;&lt;BR /&gt;run ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Required output:&lt;/P&gt;
&lt;P&gt;want='Annual da&lt;STRONG&gt;yZZZ&lt;/STRONG&gt;"';&lt;BR /&gt;want='Funny worl&lt;STRONG&gt;dZZZ&lt;/STRONG&gt;"';&lt;BR /&gt;want='reverse gea&lt;STRONG&gt;rZZZ&lt;/STRONG&gt;"';&lt;BR /&gt;want =' "Google aps"';&lt;BR /&gt;want= '" Android application"';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help on this.&lt;/P&gt;</description>
    <pubDate>Thu, 12 Dec 2019 13:40:23 GMT</pubDate>
    <dc:creator>keen_sas</dc:creator>
    <dc:date>2019-12-12T13:40:23Z</dc:date>
    <item>
      <title>PRX(Pearl) Functions: Metacharacter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PRX-Pearl-Functions-Metacharacter/m-p/611295#M178145</link>
      <description>&lt;P&gt;In the below code i want to replace only the last character along with space and double quotes to some other character as below only when there is a space between the last character and double quotes .If there is no space between the last character and double quotes then it should be unchanged.If we perform this with tranwrd then it will change all the spaces and it cannot identify the last character , but PRX functions has that feasibility , but could not able to get the exact Metacharacter to perform this . Tried with Metacharacter &lt;STRONG&gt;[ ]&lt;/STRONG&gt; but how to enclose the characters , space and double quotes not sure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data have ;&lt;BR /&gt;length have $100. ;&lt;BR /&gt;have='Annual day " ';output;&lt;BR /&gt;have='Funny world " ';output;&lt;BR /&gt;have='reverse gear "';output;&lt;BR /&gt;have =' "Google aps"';output;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;No space between last character and double quotes&lt;BR /&gt;have= '" Android application"';output;&lt;BR /&gt;run ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Required output:&lt;/P&gt;
&lt;P&gt;want='Annual da&lt;STRONG&gt;yZZZ&lt;/STRONG&gt;"';&lt;BR /&gt;want='Funny worl&lt;STRONG&gt;dZZZ&lt;/STRONG&gt;"';&lt;BR /&gt;want='reverse gea&lt;STRONG&gt;rZZZ&lt;/STRONG&gt;"';&lt;BR /&gt;want =' "Google aps"';&lt;BR /&gt;want= '" Android application"';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help on this.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2019 13:40:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PRX-Pearl-Functions-Metacharacter/m-p/611295#M178145</guid>
      <dc:creator>keen_sas</dc:creator>
      <dc:date>2019-12-12T13:40:23Z</dc:date>
    </item>
    <item>
      <title>Re: PRX(Pearl) Functions: Metacharacter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PRX-Pearl-Functions-Metacharacter/m-p/611302#M178152</link>
      <description>&lt;P&gt;A systematic, approach using substr:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
length var $100. ;
var='Annual day " ';output;
var='Funny world " ';output;
var='reverse gear "';output;
var =' "Google aps"';output;                  
var= '" Android application"';output;
run ;

data want;
set have;
if substr(var,length(var),1)=' ' then substr(var,length(var),1)='';
if substr(var,length(var)-1,1)=' ' then substr(var,length(var)-1,4)='ZZZ"';
run;

data required_output;
length var $100. ;
var='Annual dayZZZ"';output;
var='Funny worldZZZ"';output;
var='reverse gearZZZ"';output;
var =' "Google aps"';output;                  
var= '" Android application"';output;
run;

proc compare base=want compare=required_output;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-unison&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2019 13:58:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PRX-Pearl-Functions-Metacharacter/m-p/611302#M178152</guid>
      <dc:creator>unison</dc:creator>
      <dc:date>2019-12-12T13:58:59Z</dc:date>
    </item>
    <item>
      <title>Re: PRX(Pearl) Functions: Metacharacter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PRX-Pearl-Functions-Metacharacter/m-p/611304#M178154</link>
      <description>&lt;P&gt;Are those unbalanced quotes a copy/paste error or do you have a single quote in the data?&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2019 14:00:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PRX-Pearl-Functions-Metacharacter/m-p/611304#M178154</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-12-12T14:00:14Z</dc:date>
    </item>
    <item>
      <title>Re: PRX(Pearl) Functions: Metacharacter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PRX-Pearl-Functions-Metacharacter/m-p/611389#M178177</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16518"&gt;@keen_sas&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
	length have $100. ;
	have='Annual day " ';output;
	have='Funny world " ';output;
	have='reverse gear "';output;
	have =' "Google aps"';output; 
	have= '" Android application"';output;
run ;

data want;
	set have;
	want = prxchange('s/\s"\s*$/ZZZ"/',1,have);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Capture d’écran 2019-12-12 à 17.56.56.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/34728iF5D929F5E8F538C9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture d’écran 2019-12-12 à 17.56.56.png" alt="Capture d’écran 2019-12-12 à 17.56.56.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2019 20:14:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PRX-Pearl-Functions-Metacharacter/m-p/611389#M178177</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2019-12-12T20:14:33Z</dc:date>
    </item>
  </channel>
</rss>

