Help using Base SAS procedures

Scanning a character

Reply
Contributor
Posts: 65

Scanning a character

I'm trying to find the best to extract a string value that is after the 2nd "/"?

An example:
/explore/hospitality/index.cfm

I want to just have hospitality as the value.

Thanks
Super User
Posts: 17,840

Re: Scanning a character

Look up the scan () function.

scan ('/explore/hospitality/index.cfm', 2, '/');
Super User
Posts: 10,500

Re: Scanning a character

If this string may have varying "/" characters then you may want to look at the modifier B option to search backwards for the last one instead of a specific numbered position.
Ask a Question
Discussion stats
  • 2 replies
  • 142 views
  • 0 likes
  • 3 in conversation