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)
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 25. Read more here about why you should contribute and what is in it for you!
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.