data email;
input email $30.;
datalines;
[email protected]
[email protected]
[email protected]
[email protected]
;
run;
How to keep only required email address
example here keep only gmail.com address
data email;
input email $30.;
email_provider = scan(email, 2, '@');
datalines;
[email protected]
[email protected]
[email protected]
[email protected]
;
run;
There are many ways to do this including the SCAN function to read the second word in the string where an ampersand is the delimiter.
i want output those who have gmail email address in this example data contains three gmail address
i want complete three gmail address
Just use the SCAN function with "@" as delimiter to get the domain from the email address; if the result of the function is found to be "gmail.com", keep the observation. Can be done in a WHERE statement, WHERE= dataset option, or Subsetting IF, depending on where the subsetting needs to be done.
I will not insult your intelligence by providing this EXTREMELY SIMPLE code. If you cannot solve such a simple issue by now (500+ posts here), then drop your illusion that you'll ever earn money with SAS work.
It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.
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.