Hi all,
I am looking for an efficient way of extracting the initials of a name. For example:
Benjamin J. Lincoln -> BJC
Andrew Benson Jones -> ABJ
L. Michael Andersson Curt -> LMAC
I will be glad for the assistance.
Thanks
If you can be sure that the first letter of each name is always capitalized, it would be pretty easy to use the COMPRESS function to strip out lower case letters and non-alphabetic characters.
Great...that works just fine! Thanks!
Do you have any names like:
Otto Van Dyke, where Van Dyke is the last name? Would you want OVD or OV?
or Miguel De La Cruz, De La Cruz being the last name?
ballardw wrote:
Do you have any names like:
Otto Van Dyke, where Van Dyke is the last name? Would you want OVD or OV?
or Miguel De La Cruz, De La Cruz being the last name?
Or how about former White House Press Secretary Jerald terHorst, who insisted that the first "t" in "terHorst" was not capitalized?
Not long ago I had to match children's names out of a data system where there was single name field. There was not set order for first name, middle name or initial or last names; suffixes such as Junior or Jr, Second or II or Third III could be any where in the field; last names of both mother and father could be present with or without hyphens; and names like Van Dyke, al Allassi, De La Cruz and more odd constucts. So when I see a relatively unstructured request about names I cringe and ask what some people may consider odd questions.
PROPCASE gives the wrong result for Jerald terHorst, who insists the first letter "t" in his last name is not capitalized, and the "H" in his last name is capitalized.
SAS Data Management has a name parse node which uses a known name dictionary and can parse a one field name input into multiple name tokens (name_prefix, first_name, middle_name, family_name, name_suffix). Then you could take the first initial of each using an expression node.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.