DATA Step, Macro, Functions and more

keep everything to the right of the first hyphen

Accepted Solution Solved
Reply
Regular Contributor
Posts: 187
Accepted Solution

keep everything to the right of the first hyphen

Hi,

 

how can I use scan or subtr to keep everything to the right of the first hyphen?

 

 

var_have

2 - Some-what

4 - Very much

 

var_want

Some-what

Very much

 

Thanks!

 

 

 


Accepted Solutions
Solution
‎01-10-2018 02:34 PM
Super User
Posts: 2,061

Re: keep everything to the right of the first hyphen

[ Edited ]

Try

want_var=substr(var, index(var,'-')+1);

View solution in original post


All Replies
Solution
‎01-10-2018 02:34 PM
Super User
Posts: 2,061

Re: keep everything to the right of the first hyphen

[ Edited ]

Try

want_var=substr(var, index(var,'-')+1);

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 143 views
  • 4 likes
  • 2 in conversation