<?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 to use the variable name or other function in Perl regular expression ? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-variable-name-or-other-function-in-Perl-regular/m-p/805219#M317170</link>
    <description>Thank you so much Chris. &lt;BR /&gt;This is exactly what I am expecting. &lt;BR /&gt;Where can I find the list to identify the HEX values(\x00-\x1F\x7F-\xFF) which you mentioned.&lt;BR /&gt;</description>
    <pubDate>Thu, 31 Mar 2022 07:59:27 GMT</pubDate>
    <dc:creator>bhanuprakash</dc:creator>
    <dc:date>2022-03-31T07:59:27Z</dc:date>
    <item>
      <title>How to use the variable name or other function in Perl regular expression ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-variable-name-or-other-function-in-Perl-regular/m-p/805207#M317160</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am able to replace special characters with empty spaces in the text2 argument. However I am not able to achieve the same in the text3 argument. &amp;nbsp;Can you please let us know how to use other functions/ variable names in the Perl regular expression?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data a;&lt;BR /&gt;input text $80.;&lt;BR /&gt;datalines;&lt;BR /&gt;The phone numberØ for Ed is (801)443-9876Ø but not until tonight.&lt;BR /&gt;He can be reached Øat (910)998-8762 Øtomorrow for testing purposesØ.&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;data b;&lt;BR /&gt;set a;&lt;BR /&gt;text2=prxchange("s/Ø//", -1, text);&lt;BR /&gt;test3 = prxchange("s/byte(216)//", -1, text);&lt;BR /&gt;test4= byte(216);&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; Regards,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bhanu Prakash Pala&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2022 06:52:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-variable-name-or-other-function-in-Perl-regular/m-p/805207#M317160</guid>
      <dc:creator>bhanuprakash</dc:creator>
      <dc:date>2022-03-31T06:52:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the variable name or other function in Perl regular expression ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-variable-name-or-other-function-in-Perl-regular/m-p/805209#M317162</link>
      <description>&lt;P&gt;I only use regular expressions for the real complex stuff.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can get very far with these 3 SAS functions :&lt;/P&gt;
&lt;UL class="lia-list-style-type-disc"&gt;
&lt;LI&gt;TRANSLATE Function&lt;/LI&gt;
&lt;LI&gt;TRANSTRN Function&lt;/LI&gt;
&lt;LI&gt;TRANWRD Function&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2022 07:05:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-variable-name-or-other-function-in-Perl-regular/m-p/805209#M317162</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2022-03-31T07:05:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the variable name or other function in Perl regular expression ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-variable-name-or-other-function-in-Perl-regular/m-p/805210#M317163</link>
      <description>&lt;P&gt;Yes, I was aware that we can achieve using those functions. I wanted to use a regular expression to achieve the requirement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please suggest to me if there are any other ways in the regular expressions. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2022 07:10:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-variable-name-or-other-function-in-Perl-regular/m-p/805210#M317163</guid>
      <dc:creator>bhanuprakash</dc:creator>
      <dc:date>2022-03-31T07:10:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the variable name or other function in Perl regular expression ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-variable-name-or-other-function-in-Perl-regular/m-p/805211#M317164</link>
      <description>&lt;P&gt;If special character means anything outside of the lower ascii characters (33 to 126, i.e. ! to ~), this might help:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;VAR2 = prxchange('s/[^!-~]/ /', -1, VAR);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Be careful if using UTF8 encoding.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2022 07:17:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-variable-name-or-other-function-in-Perl-regular/m-p/805211#M317164</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2022-03-31T07:17:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the variable name or other function in Perl regular expression ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-variable-name-or-other-function-in-Perl-regular/m-p/805214#M317166</link>
      <description>&lt;P&gt;I wanted to replace blank if we have ASCII specifically characters (1-31,127-255) in the Text. I can’t type those characters manually. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;Our program should work in dynamic way.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2022 07:23:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-variable-name-or-other-function-in-Perl-regular/m-p/805214#M317166</guid>
      <dc:creator>bhanuprakash</dc:creator>
      <dc:date>2022-03-31T07:23:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the variable name or other function in Perl regular expression ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-variable-name-or-other-function-in-Perl-regular/m-p/805216#M317168</link>
      <description>&lt;P&gt;Same thing.&lt;/P&gt;
&lt;P&gt;Another way to code that:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; VAR2 = prxchange('s/[^\x21-\x7E]/ /', -1, VAR); &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; VAR2 = prxchange('s/[\x00-\x1F\x7F-\xFF]/ /',-1, VAR); &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2022 07:39:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-variable-name-or-other-function-in-Perl-regular/m-p/805216#M317168</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2022-03-31T07:39:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the variable name or other function in Perl regular expression ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-variable-name-or-other-function-in-Perl-regular/m-p/805219#M317170</link>
      <description>Thank you so much Chris. &lt;BR /&gt;This is exactly what I am expecting. &lt;BR /&gt;Where can I find the list to identify the HEX values(\x00-\x1F\x7F-\xFF) which you mentioned.&lt;BR /&gt;</description>
      <pubDate>Thu, 31 Mar 2022 07:59:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-variable-name-or-other-function-in-Perl-regular/m-p/805219#M317170</guid>
      <dc:creator>bhanuprakash</dc:creator>
      <dc:date>2022-03-31T07:59:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the variable name or other function in Perl regular expression ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-variable-name-or-other-function-in-Perl-regular/m-p/805220#M317171</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/124649"&gt;@bhanuprakash&lt;/a&gt;&amp;nbsp;Given that your RegEx actually removes characters without replacing them with a blank the compress() function might also do the job for you.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To be considered for using compress():&lt;/P&gt;
&lt;P&gt;1. compress() will perform better than RegEx which might be relevant in case you're dealing with bigger data volumes&lt;/P&gt;
&lt;P&gt;2. The SAS RegEx functions can only get used with single byte encoded data. If your data is multibyte encoded then consider using function kcompress() with the appropriate modifiers.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
  input text $80.;
  datalines;
The phone numberØ for Ed is (801)443-9876Ø but not until tonight.
He can be reached Øat (910)998-8762 Øtomorrow for testing purposesØ.
;
run;

data b;
  set a;
  text2=prxchange("s/Ø//", -1, text);
  text3=prxchange('s/[\x01-\x1B\x7F-\xFF]//', -1, text);
  text4=compress(text,' ','knp');
run;

proc print data=b;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And to find the hex values for ASCII values just Google for ASCII Table and you'll find what you need.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2022 08:23:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-variable-name-or-other-function-in-Perl-regular/m-p/805220#M317171</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-03-31T08:23:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the variable name or other function in Perl regular expression ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-variable-name-or-other-function-in-Perl-regular/m-p/805221#M317172</link>
      <description>&lt;P&gt;Any ASCII table will show the list of characters. Just search that.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2022 08:26:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-variable-name-or-other-function-in-Perl-regular/m-p/805221#M317172</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2022-03-31T08:26:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the variable name or other function in Perl regular expression ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-variable-name-or-other-function-in-Perl-regular/m-p/805625#M317358</link>
      <description>&lt;P&gt;Post-Factum, but may still be useful to you !&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Transcoding: Understand, Troubleshoot, and Resolve a Most Mysterious SAS® Error&lt;BR /&gt;Posted 03-15-2021 09:43 AM | by imujulie&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Global-Forum-Proceedings/Transcoding-Understand-Troubleshoot-and-Resolve-a-Most/ta-p/726296" target="_blank"&gt;https://communities.sas.com/t5/SAS-Global-Forum-Proceedings/Transcoding-Understand-Troubleshoot-and-Resolve-a-Most/ta-p/726296&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Sat, 02 Apr 2022 13:17:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-variable-name-or-other-function-in-Perl-regular/m-p/805625#M317358</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2022-04-02T13:17:46Z</dc:date>
    </item>
  </channel>
</rss>

