Hello,
Here below I have a column called EMAIL
Of all the emails we wanted to check how many times gmail was wrongly entered....
Since GMAIL starts with the letter "G" we can take all the words starting with letter G after @ in the email adress??????
HAVE:
elephant@gmail.con
goat@yahoo.com
horse@hotmail.com
WANT:
gmail.com 2
gunail.com 1
GMAI.COM 1
gmail.con 1
gnail.com 1
gmi.com 1
I will suggest that limiting your search to @g is insufficient. You may well have enteries like [email protected] or [email protected] or ...
I might be tempted to do something like:
data have;
length email $40.;
input email;
isp =upcase(scan(email,2,"@"));
distance = complev('gmail.com',isp,'i');
datalines;
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
;
proc tabulate data=have;
class distance isp;
table distance*isp,n;
run;
The "distance" value when small means the spelling is "close" to Gmail.com.
Note that I did add in couple of other possibly typos.
I will suggest that limiting your search to @g is insufficient. You may well have enteries like [email protected] or [email protected] or ...
I might be tempted to do something like:
data have;
length email $40.;
input email;
isp =upcase(scan(email,2,"@"));
distance = complev('gmail.com',isp,'i');
datalines;
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
;
proc tabulate data=have;
class distance isp;
table distance*isp,n;
run;
The "distance" value when small means the spelling is "close" to Gmail.com.
Note that I did add in couple of other possibly typos.
Nearly 200 sessions are now available on demand in the Innovate Hub.
Watch Now →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.
Ready to level-up your skills? Choose your own adventure.