Hi. I am trying to extract name intials from a variable containing names. Since all names have their initials in capital letters, my attempt was to do the following work:
This way, the y variable contains, "J", "L" and "P". However, what I really want is "JS", "LJ" and "PBB".
I appreciate any hints on how can I solve this problem.
Thanks in advance.
Code:
clear all input str13 x "John Smith" "Linda Johnson" "Peter B. Brown" end g y = regexs(0) if regexm(x,"[A-Z]")
I appreciate any hints on how can I solve this problem.
Thanks in advance.
Comment