DATA Step, Macro, Functions and more

Substring a alphanumeric string starting from first character in the string

Accepted Solution Solved
Reply
Contributor
Posts: 29
Accepted Solution

Substring a alphanumeric string starting from first character in the string

Hi ,

 

I want to substring the alphanumeric string

example 00000031700ALLISON S00001

 

 

which are of different length. I just need to extract the substring starting with first character that is ALLISON S00001.

 

so the result of substring from

00000031700ALLISON S00001

 

is below

ALLISON S00001

 

 


Accepted Solutions
Solution
‎12-11-2017 12:07 PM
Super User
Posts: 8,220

Re: Substring a alphanumeric string starting from first character in the string

Here is one way:

data have;
  informat string $80.;
  input string &;
  want=substr(string,anyalpha(string));
  cards;
00000031700ALLISON S00001
;

Art, CEO, AnalystFinder.com

 

View solution in original post


All Replies
Solution
‎12-11-2017 12:07 PM
Super User
Posts: 8,220

Re: Substring a alphanumeric string starting from first character in the string

Here is one way:

data have;
  informat string $80.;
  input string &;
  want=substr(string,anyalpha(string));
  cards;
00000031700ALLISON S00001
;

Art, CEO, AnalystFinder.com

 

Contributor
Posts: 29

Re: Substring a alphanumeric string starting from first character in the string

Thanks! That works
☑ This topic is solved.

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

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