Desktop productivity for business analysts and programmers

Extracting Characters

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 15
Accepted Solution

Extracting Characters

Trying to extract only characters from a column, i.e.

 

JIM325612

SARAH651291

 

Each has 6 digits behind them but the amount of characters vary. How do I just pull the characters using 'SUBSTR' or something similar?


Accepted Solutions
Solution
‎01-22-2018 04:06 PM
PROC Star
Posts: 1,283

Re: Extracting Characters

want=compress(your_variable,,'d');

View solution in original post


All Replies
Solution
‎01-22-2018 04:06 PM
PROC Star
Posts: 1,283

Re: Extracting Characters

want=compress(your_variable,,'d');
PROC Star
Posts: 1,283

Re: Extracting Characters

Posted in reply to novinosrin
data h;
input var $15.;
datalines;
JIM325612
SARAH651291
;
data want;
set h;
want=compress(var,,'d');
run;
Occasional Contributor
Posts: 15

Re: Extracting Characters

Posted in reply to novinosrin

Thank you so much! Worked perfect!

☑ This topic is solved.

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

Discussion stats
  • 3 replies
  • 151 views
  • 0 likes
  • 2 in conversation