05-07-2018 04:08 AM
Would like to check if there are any SAS intelligence in coding to check whether the phone number or an email in dataset is a valid one?
Thanks for the sharing.
With sincere regards,
05-07-2018 04:20 AM
You have to be much more specific than that. What does "a valid one" mean? Show us some example data and explain what valid means in this context.
05-07-2018 04:32 AM
There are ways to check the validity of an email, but they only work if the target server cooperates (which is often turned off to make spamming harder). So you are left with sending a email and checking for a response, which is best done through a proper email client.
05-07-2018 11:14 AM
Phone number rules would be needed. And if you have multiple countries involved you may need additional rules for each. Such as determining international country codes as part of the numbers.
Likely bits may be looking for patterns of spaces, periods, commas, dashes(of multiple characters such as (208) 123-4567 or 208-123-4567, 208.123.4567 and so on.
If the original field is manually entered and there are not appropriate constraints you may have to find things like ext 123 (office extensions) and similar.
Note that removing all non-numeric characters and then checking may be insufficient as international codes may make a number look like another source.
05-08-2018 08:18 AM
For e-mail, using a regular expression similar to the one you have is probably best. That validates the form of the e-mail address, not whether it's active (of course!). If you use PRXPARSE to compile the pattern and then PRXMATCH to check for it, it should be pretty fast. I have an example of that in this article about validating variable names.