BookmarkSubscribeRSS Feed
Grandhi4
Calcite | Level 5

Hi,

I have some two million records (email id's) in that some of wrong email addresses like ('@' missing, '.com' missing, '.net' missing,...) and each email address their own character length...so now my question is 1) How to identify the 'error' email id's ?

2) How to delete 'error' email id's ?

3) How to make a two different data sets for 'error ones' and 'non errors' ?

any one can please help the logic (code).

Thanks,

Suresh

2 REPLIES 2
RickM
Fluorite | Level 6

For finding valid adresses I think perl regular expressions functions would be a good way (prxparse, prxmatch).

You can output data to different datasets within the same data step.

data A B;

set C;

if condition then output A;

else output B;
run;

Good luck!

FriedEgg
SAS Employee

data eml;

input eml $20.;

cards;

valid@email.com

bad@email.sdglkjasd

b ad@space.net

notanemail.com

;

run;

data good bad;

set eml;

if ^prxmatch('/^\w[\w\.\-]*\w\@\w[\w\.\-]*\w(\.\w{2,4})$/',strip(eml)) then output bad;

  else output good;

run;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2 replies
  • 921 views
  • 3 likes
  • 3 in conversation