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
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Lock in the best rate now before the price increases on April 1.
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.