Extract character value from a string

Reply
Occasional Learner
Posts: 1

Extract character value from a string

Hi,

I need to extract only Character string from a particular cell.

For example,

CACC11
CK0086

From above 2 values, I need only character values, like

CACC

CK

Please let me know how we can do that?

Thanks

Kinjal

Super User
Posts: 11,343

Re: Extract character value from a string

For your example data this works. Look at the other examples and see they would behave as desired:

data example;

   length string newstring $ 10;

   input string;

   newstring = compress(string,'1234567890');

datalines;

CACC11

CK0086

CK0AB6

89BB00

12345

;

run;

Ask a Question
Discussion stats
  • 1 reply
  • 201 views
  • 0 likes
  • 2 in conversation