Hello,
I would like to split a character variable in SAS Viya 4 containing last names. In many cases the variable contains the last name of both partners seperated by a '-'. However, we only want the first last name. The variable looks something like this: 'xxxxxx - xxxxx'. I have tried the functions substring and getword in Viya 4, but they do not seem to do the trick. This is because many last names consist out of multiple words and both functions are not well suited for this.
Does someone have any idea how to tackle this in Viya?
Thanks in advance.
Rik
In Visual Analytics you can use the FindChar / FindString functions instead, in contrast to the FindWord function you can specify the separator(s) this way. For your example this could work:
I see I mentioned the wrong environment. I mean Visual Analytics. The scan function is not part of this.
In Visual Analytics you can use the FindChar / FindString functions instead, in contrast to the FindWord function you can specify the separator(s) this way. For your example this could work:
Thanks! This worked
Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.
Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.
See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.
Find more tutorials on the SAS Users YouTube channel.