If I have
Name:
Jack784Jill
Animesh56Mardi
Len7lenove
acer789542aspire
and wanted to extract 1st and last name only using scan and compress function
Sounds like homework.
SCAN(string, count <, character-list <, modifier>>)
Use d as value for the modifier in scan function to define digits as the word separators, set count to 1 to extract the first word, and to -1 to extract the last word.
As a minimum you should indicate which part of those values is Last name and which is a first name.
Which actually does not clarify which is last name and which is first. Plus you have also changed the case of the string but only for some.
@animesh123 wrote:
So as in example
1st_str
Jack
Animesh
Len
Acer
2nd_str
Jill
Mardi
Lenove
Sounds like homework.
SCAN(string, count <, character-list <, modifier>>)
Use d as value for the modifier in scan function to define digits as the word separators, set count to 1 to extract the first word, and to -1 to extract the last word.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.