Help using Base SAS procedures

Substr help

Reply
N/A
Posts: 0

Substr help

I have a list of records of Brief No's in the format xxxxx-yy

I wish to keep only the 'x's, however, they are not a standard length, some are 6 characters long, some 5. The 'y's aren't strictly 2 character's either, sometimes one, sometimes 2.

The only constant is the hyphen.

How can I use the Substr to keep only the part of the string before the hyphen?

Thanks in advance
Super User
Posts: 5,424

Re: Substr help

Posted in reply to deleted_user
scan(breifNo,1,'-')
Data never sleeps
N/A
Posts: 0

Re: Substr help

Posted in reply to deleted_user
thanks! worked a treat!
Ask a Question
Discussion stats
  • 2 replies
  • 145 views
  • 0 likes
  • 2 in conversation