BookmarkSubscribeRSS Feed
nicolaskan
Fluorite | Level 6

Hi guys,

 

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,

Nicolas

4 REPLIES 4
PeterClemmensen
Tourmaline | Level 20

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.

Kurt_Bremser
Super User

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.

ballardw
Super User

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.

ChrisHemedinger
Community Manager

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.


For phone numbers, check out this tip by @Ron_Cody about standardizing phone numbers in your data.  You could standardize and QC the phone numbers in one pass through the data.

 

 

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 2604 views
  • 0 likes
  • 5 in conversation