<?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: Using Perl Regular Expressions to find social security number (CPR) in SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Using-Perl-Regular-Expressions-to-find-social-security-number/m-p/513834#M138508</link>
    <description>&lt;P&gt;Thank you for a quick, fun and precise reply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My problem then simply was to understand I needed to put slashes first and last in the expression.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much.&lt;/P&gt;</description>
    <pubDate>Fri, 16 Nov 2018 09:51:05 GMT</pubDate>
    <dc:creator>SanderEhmsen</dc:creator>
    <dc:date>2018-11-16T09:51:05Z</dc:date>
    <item>
      <title>Using Perl Regular Expressions to find social security number (CPR) in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Perl-Regular-Expressions-to-find-social-security-number/m-p/513830#M138506</link>
      <description>&lt;P&gt;&amp;nbsp;Hi all&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In Denmark everybody&amp;nbsp;is given a CPR-number at birth (social security number).&lt;/P&gt;
&lt;P&gt;This is a UUID for a person.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As by GDPR we need to scan our folders regulary to find if anybody by accident has put a CPR-number in a folder that is not documented.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the moment we would like to use SAS to do this task for us in my department.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have thus developed a macro-function that find allmost every instance of a CPR-number in our folders. Nevertheless I&amp;nbsp;would like to improve my macro function using Perl Reg Ex.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In google a colleague of mine has developed the following syntax&lt;/P&gt;
&lt;P&gt;(\W|^)([0-3])\d{1}([0-1])\d{3}[\s-_]{0,1}\d{4}(\W|$)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So a cpr contains 10 characters. The first can be between ('0','1','2','3')&amp;nbsp;the third can be ('0','1').&lt;/P&gt;
&lt;P&gt;The rest can be any&amp;nbsp;character between '0' and '9'.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sometimes a cpr-number is made of 11 characters where the 7th is a '-' (line).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a hard time understanding Perl Reg Ex in SAS.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can anyone reform the abovestanding google code so it will fit in SAS.&lt;/P&gt;
&lt;P&gt;I have&amp;nbsp;consultet the Tip Sheet (&lt;A href="https://support.sas.com/rnd/base/datastep/perl_regexp/regexp-tip-sheet.pdf).&amp;nbsp;" target="_blank"&gt;https://support.sas.com/rnd/base/datastep/perl_regexp/regexp-tip-sheet.pdf).&amp;nbsp;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i believe I should use the prxmatch-function.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;Sander.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 09:35:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Perl-Regular-Expressions-to-find-social-security-number/m-p/513830#M138506</guid>
      <dc:creator>SanderEhmsen</dc:creator>
      <dc:date>2018-11-16T09:35:47Z</dc:date>
    </item>
    <item>
      <title>Re: Using Perl Regular Expressions to find social security number (CPR) in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Perl-Regular-Expressions-to-find-social-security-number/m-p/513833#M138507</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perl regex in SAS are ... Perl regex. So the expression you have found&lt;/P&gt;
&lt;P&gt;can be used as is. You can use prxmatch to match string agains the expression as follows.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _NULL_;
input str $50.;

if prxmatch("/(\W|^)([0-3])\d{1}([0-1])\d{3}[\s-_]{0,1}\d{4}(\W|$)/",str) then put "OK";
else put "KO";
cards;
kjhkj 0113816723 oiuoiuoiu
0123816723 3543434
0113816723 54556663p oiu
0113816723
oioiuoi 5113816723 oo
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Nov 2018 09:46:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Perl-Regular-Expressions-to-find-social-security-number/m-p/513833#M138507</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2018-11-16T09:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: Using Perl Regular Expressions to find social security number (CPR) in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Perl-Regular-Expressions-to-find-social-security-number/m-p/513834#M138508</link>
      <description>&lt;P&gt;Thank you for a quick, fun and precise reply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My problem then simply was to understand I needed to put slashes first and last in the expression.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 09:51:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Perl-Regular-Expressions-to-find-social-security-number/m-p/513834#M138508</guid>
      <dc:creator>SanderEhmsen</dc:creator>
      <dc:date>2018-11-16T09:51:05Z</dc:date>
    </item>
  </channel>
</rss>

