BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Tihannah
Obsidian | Level 7

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?

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20
want=compress(your_variable,,'d');

View solution in original post

3 REPLIES 3
novinosrin
Tourmaline | Level 20
want=compress(your_variable,,'d');
novinosrin
Tourmaline | Level 20
data h;
input var $15.;
datalines;
JIM325612
SARAH651291
;
data want;
set h;
want=compress(var,,'d');
run;
Tihannah
Obsidian | Level 7

Thank you so much! Worked perfect!

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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