DATA Step, Macro, Functions and more

1. how to capture the last character of a string using functions

Reply
New User
Posts: 1

1. how to capture the last character of a string using functions

1. how to capture the last character of a string using functions 

2. how to capture the middle word of the string 

Super User
Posts: 8,218

Re: 1. how to capture the last character of a string using functions

Posted in reply to mujahid1303

Provide a couple of examples and the results you'd want from those examples. Make sure to include at least one example that has an even number of words.

 

Art, CEO, AnalystFinder.com

 

Super User
Posts: 5,917

Re: 1. how to capture the last character of a string using functions

Posted in reply to mujahid1303
1) SUBSTR() using -1 for position.
2) Middle is not always clear, whatbif there's a even no of words? Besides that, you could use a combination of COUNTW and SCAN functions.
Data never sleeps
Ask a Question
Discussion stats
  • 2 replies
  • 228 views
  • 0 likes
  • 3 in conversation