Hi there!
I'm asked to do the following below in SAS Visual Analytics. I'm using SAS Viya for Learners 3.5.
This is what I have so far. it looks good in the beginning but once I reach the later parts of the data, the string I want isn't correctly extracted. I need assistance on how to extract part of a string before a delimiter. In this case, before the colon.
Thanks in advance.
You are very close! This looks like a learning exercise so I won't give the answer away entirely, but I'll give you a hint. Consider that the length of the substring before : varies in length:
10-5:23.6,-51.2 10-100:23.6,-51.2
If you could find the position of the :, then you would know exactly how long your substring needs to be:
10-5:23.6,-51.2
^
5
10-100:23.6,-51.2
^
7
Is there another function that can help you do this?
It took me some time to figure it out. I thought it was the getlength at first but I realized it's the findchar.
thanks for the hint!
Bingo! Awesome work 😃
Substring('from_loc'n, 1, FindChar('from_loc'n, ':')-1)
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!
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.