Help using Base SAS procedures

name string

Accepted Solution Solved
Reply
Contributor
Posts: 42
Accepted Solution

name string

SALATA,EDYTA
CORNELL,NANCY A.
ROUNDTREE,WILLA M.

how to remove the middle name listed in the end of the name like A. M. above?

Thanks!


Accepted Solutions
Solution
‎09-09-2013 12:07 PM
Super User
Super User
Posts: 7,039

Re: name string

For these simple examples you can use SCAN with blank as the delimiter since there are no blanks between the last and first name.

scan(name,1,' ')

But real names are more complicated than this.  What about people with spaces in their first name or last name? Or those that use initials? 

R.A. Dickey Stats, News, Pictures, Bio, Videos - Toronto Blue Jays - ESPN

View solution in original post


All Replies
Solution
‎09-09-2013 12:07 PM
Super User
Super User
Posts: 7,039

Re: name string

For these simple examples you can use SCAN with blank as the delimiter since there are no blanks between the last and first name.

scan(name,1,' ')

But real names are more complicated than this.  What about people with spaces in their first name or last name? Or those that use initials? 

R.A. Dickey Stats, News, Pictures, Bio, Videos - Toronto Blue Jays - ESPN

Contributor
Posts: 42

Re: name string

Thank you very much for your great help!

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 174 views
  • 0 likes
  • 2 in conversation