Hello,
I recently posted a question about phone number validation, etc, and was referred to this article: https://heuristically.wordpress.com/2012/10/30/pho ne-number-validation-in-sas/
It's a great article and the program works fine, however, when i look through my results I'm not getting the flags I would expect based on how that portion of the program is written.
/* A=area code not in service */
if substr(&sm_phone_number, 1, 3) not in (&mv_npa) then &sm_exception = 'A';
/* R=repeating number like 5555555555 is a probable fake */
if prxmatch('/^([0-9])(\1{9})$/', strip(&sm_phone_number)) eq 1 then &sm_exception = 'R';
/* I=Skype and Google GMail phone numbers do not allow inbound calls */
if &sm_phone_number in ('2025808200', '7607058888') then &sm_exception = 'I';
/* D=directory assistance <https://en.wikipedia.org/wiki/555-1212> */
if prxmatch('/^[0-9]{3}5551212$/', trim(&sm_phone_number)) eq 1 then &sm_exception = 'D';
/* F=numbers specifically reserved for fictional use are "555-0100" through "555-0199" */
if prxmatch('/^[2-9][0-8][0-9]55501[0-9]{2}$/', strip(&sm_phone_number)) eq 1 then &sm_exception = 'F'; /* fake */
/* 1=the last two digits of NXX cannot both be 1, to avoid confusion with the N11
* codes (http://en.wikipedia.org/wiki/North_American_Numbering_Plan)
* Only non-geographic area codes, such as toll-free 800/888/877/866/855 numbers
* and 900 numbers may use N11 as the telephone exchange prefix, since
* the area code must always be dialed for these numbers.
* <https://en.wikipedia.org/wiki/N11_code> */
if (prxmatch('/^(800|888|877|866|855|900)/', strip(&sm_phone_number)) ne 1) and
(prxmatch('/^[2-9][0-8][0-9][2-9]11[0-9]{4}\b/', strip(&sm_phone_number)) eq 1) then &sm_exception = '1';
/* S=basic NANP syntax */
if prxmatch('/^\(?[2-9][0-8][0-9]\)? ?[2-9][0-9]{2}-?[0-9]{4}\b/', strip(&sm_phone_number)) ne 1 then &sm_exception = 'S';
For example, all phone numbers in my dataset with sequential numbers like '000000000' or '9999999998', etc, are being flagged as "S" instead of "R" and I can't figure out why. I've been reading all the literature online regarding PRXMatch but it's not clicking for me.
A thought just occured to me, could this be because my phone number fields are all text?
I appreciate any insight into this. Thanks!
... View more