<?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 Creating a Perl Expression in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-Perl-Expression/m-p/60728#M13170</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am a newbie to Perl discussions and hoping that someone can help me with this question.&amp;nbsp; I am trying to identfiy and remove Patient ids in a free form text string using Perl expression - the conditions are as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. The ids are always 8 bytes and can contains letters(upper or lowercase) and numbers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. The ids will always contain at least 1 digit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the expression I tried to build but I end up picking all 8 letter words.&amp;nbsp; The negated class does not seem to work either.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's my code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;id_re=prxparse('s/\b[a-zA-Z0-9]{8}\b/ &amp;amp;id removed&amp;amp; /')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas - how can find the 8 byte ids.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 05 Sep 2011 18:44:08 GMT</pubDate>
    <dc:creator>SAS09</dc:creator>
    <dc:date>2011-09-05T18:44:08Z</dc:date>
    <item>
      <title>Creating a Perl Expression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-Perl-Expression/m-p/60728#M13170</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am a newbie to Perl discussions and hoping that someone can help me with this question.&amp;nbsp; I am trying to identfiy and remove Patient ids in a free form text string using Perl expression - the conditions are as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. The ids are always 8 bytes and can contains letters(upper or lowercase) and numbers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. The ids will always contain at least 1 digit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the expression I tried to build but I end up picking all 8 letter words.&amp;nbsp; The negated class does not seem to work either.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's my code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;id_re=prxparse('s/\b[a-zA-Z0-9]{8}\b/ &amp;amp;id removed&amp;amp; /')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas - how can find the 8 byte ids.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Sep 2011 18:44:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-Perl-Expression/m-p/60728#M13170</guid>
      <dc:creator>SAS09</dc:creator>
      <dc:date>2011-09-05T18:44:08Z</dc:date>
    </item>
    <item>
      <title>Creating a Perl Expression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-Perl-Expression/m-p/60729#M13171</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm just starting to learn regular expressions, thus can't be of much help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think the expression you want is: ^(?=[a-zA-z0-9]*\d).{8,8}$&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That would match an eight character string that contained only letters and or numbers, and contained at least one number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately, I don't know how to implement it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Sep 2011 22:42:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-Perl-Expression/m-p/60729#M13171</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-09-05T22:42:16Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a Perl Expression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-Perl-Expression/m-p/60730#M13172</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;PRE&gt; 
data ID_REDACTED;
&amp;nbsp;&amp;nbsp; infile datalines truncover;
&amp;nbsp;&amp;nbsp; input text1 $100.;
&amp;nbsp;&amp;nbsp; text2 = prxchange('s/\s\w1\d+\s/ *REDACTED* /', -1, text1);
&amp;nbsp;&amp;nbsp; datalines;
This patent ID abcdef01 should be removed.
This is NOT a patent ID abcdefgh and should remain.
This is NOT a patent ID 123455 and should remain.
;
run;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Mark Jordan to improve the Regular Expression&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Sep 2011 00:07:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-Perl-Expression/m-p/60730#M13172</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2011-09-06T00:07:08Z</dc:date>
    </item>
    <item>
      <title>Creating a Perl Expression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-Perl-Expression/m-p/60731#M13173</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't know if the following is quite what you had in mind, but it does appear to eliminate the unwanted IDs:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; length stuff $20;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input;&lt;/P&gt;&lt;P&gt;&amp;nbsp; i=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do until (scan(_infile_,i," ") eq "");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; stuff=scan(_infile_,i," ");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; i+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;Now is the time for all good men and women&lt;/P&gt;&lt;P&gt;to come to the GG5567AA aid of their party&lt;/P&gt;&lt;P&gt;Or, was it 4567890 or 45678901 that caused&lt;/P&gt;&lt;P&gt;the problems.&lt;/P&gt;&lt;P&gt;4567890&lt;/P&gt;&lt;P&gt;45678901&lt;/P&gt;&lt;P&gt;ABC4EFGH&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want notwant;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; want = PrxChange( 's/^\b(?=[A-Z0-9]*\d).{8,8}\b//io' ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -1 , Stuff );&lt;/P&gt;&lt;P&gt;&amp;nbsp; if want ne "" then output want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; else output notwant;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Sep 2011 00:36:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-Perl-Expression/m-p/60731#M13173</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-09-06T00:36:14Z</dc:date>
    </item>
    <item>
      <title>Creating a Perl Expression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-Perl-Expression/m-p/60732#M13174</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN&gt;I find this page to be quite helpful in building/testing regex: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://gskinner.com/RegExr/"&gt;http://gskinner.com/RegExr/&lt;/A&gt;&lt;SPAN&gt; (uses Flash).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sometimes SAS needs a few adjustments to work, either for non-standard stuff or it's own quirks - but it's a good site nonetheless.&amp;nbsp; There's allot of examples, and the tool will help show you the meanings of the different codes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Sep 2011 12:26:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-Perl-Expression/m-p/60732#M13174</guid>
      <dc:creator>DF</dc:creator>
      <dc:date>2011-09-06T12:26:48Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a Perl Expression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-Perl-Expression/m-p/60733#M13175</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I crossposted your request on a similar forum (i.e., SAS-L) and a friend/sas/Perl expert (i.e., Toby Dunn) offered the following solution to the problem you raised:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt; length stuff $ 80;&lt;/P&gt;&lt;P&gt; input Stuff &amp;amp; ;&lt;/P&gt;&lt;P&gt; cards;&lt;/P&gt;&lt;P&gt; Now is the time for all good men and women&lt;/P&gt;&lt;P&gt; to come to the gh5567AA aid of their party&lt;/P&gt;&lt;P&gt; Or, was it 4567890 or 45678901 that caused&lt;/P&gt;&lt;P&gt; the problems problems.&lt;/P&gt;&lt;P&gt; 4567890&lt;/P&gt;&lt;P&gt; 45678901&lt;/P&gt;&lt;P&gt; 1234_678&lt;/P&gt;&lt;P&gt; 1234/678&lt;/P&gt;&lt;P&gt; ABC4EFGH&lt;/P&gt;&lt;P&gt; ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set Have ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; stuff2 = PrxChange( 's/(?=\b[A-Z0-9]{8}\b)\b[A-Z0-9]*\d[A-Z0-9]*\b//oi' , -1 , Stuff ) ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Sep 2011 13:21:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-Perl-Expression/m-p/60733#M13175</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-09-06T13:21:03Z</dc:date>
    </item>
    <item>
      <title>Creating a Perl Expression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-Perl-Expression/m-p/60734#M13176</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much!! This seems to do it!&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks to everyone who replied - I have learnt a lot from all of you suggestions!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Sep 2011 14:38:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-Perl-Expression/m-p/60734#M13176</guid>
      <dc:creator>SAS09</dc:creator>
      <dc:date>2011-09-06T14:38:56Z</dc:date>
    </item>
  </channel>
</rss>

