BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
aanan1417
Quartz | Level 8

i want to take out last name from given string

data have;

length a $200.;

input a;

datalines;

rahulyadav@gmail.com

mahindersinghdoni@gmail.com

avakumari@hotmail.com

;

run;

 

output

yadav

dhoni

kumari

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

@aanan1417 wrote:
sorry typing error

I don't believe e-mail addresses can have spaces, and so you need to address that, and provide rules given that restriction

--
Paige Miller

View solution in original post

7 REPLIES 7
PaigeMiller
Diamond | Level 26

Please explain the rules you followed to determine the output of the first line is yadav.

--
Paige Miller
aanan1417
Quartz | Level 8
i want to take out yadav from first line
dhoni from second line
kumari from last line
PaigeMiller
Diamond | Level 26

I specifically asked for the rules that let you know how to figure out what the last name is. Without rules, we can't write a program.

--
Paige Miller
aanan1417
Quartz | Level 8
their is space between name for example
rahul yadav @gmail.com
mahender singh doni @gmail.com
ava kumari @gmail.com
PaigeMiller
Diamond | Level 26

There is no space in the names in your input data.


E-mail addresses cannot have spaces.

--
Paige Miller
aanan1417
Quartz | Level 8
sorry typing error
PaigeMiller
Diamond | Level 26

@aanan1417 wrote:
sorry typing error

I don't believe e-mail addresses can have spaces, and so you need to address that, and provide rules given that restriction

--
Paige Miller

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 903 views
  • 1 like
  • 2 in conversation