Help using Base SAS procedures

substring by delimiter?

Accepted Solution Solved
Reply
Contributor
Posts: 66
Accepted Solution

substring by delimiter?

Hi,

I have a character field i'd like to clean up by using a delimiter.

for example my data has a bunch of codes that look like:

tmp435-abc

tmp902-cde

tp309-dmco

etc.

i'd like to clean up the variable to cut off at the '-' delimiter.

I'm not sure what the right function to use is.

Thanks for your help.


Accepted Solutions
Solution
‎02-23-2012 12:47 PM
Super User
Posts: 5,513

substring by delimiter?

Posted in reply to Danglytics

varname = scan(varname, 1, '-');

View solution in original post


All Replies
Solution
‎02-23-2012 12:47 PM
Super User
Posts: 5,513

substring by delimiter?

Posted in reply to Danglytics

varname = scan(varname, 1, '-');

Contributor
Posts: 66

substring by delimiter?

Posted in reply to Astounding

thank you.

🔒 This topic is solved and locked.

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

Discussion stats
  • 2 replies
  • 10432 views
  • 2 likes
  • 2 in conversation