BookmarkSubscribeRSS Feed
ngunan0921
Calcite | Level 5

Hi there! 

I'm asked to do the following below in SAS Visual Analytics. I'm using SAS Viya for Learners 3.5. 

 

ngunan0921_0-1698653333348.png

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. 

ngunan0921_1-1698653526584.png

ngunan0921_2-1698653769644.png

Thanks in advance. 

 

3 REPLIES 3
Stu_SAS
SAS Employee

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?

ngunan0921
Calcite | Level 5

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!

Stu_SAS
SAS Employee

Bingo! Awesome work 😃

Substring('from_loc'n, 1, FindChar('from_loc'n, ':')-1)

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Tips for filtering data sources in SAS Visual Analytics

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.

Discussion stats
  • 3 replies
  • 784 views
  • 2 likes
  • 2 in conversation