BookmarkSubscribeRSS Feed
Talita28
Calcite | Level 5

Hi all!

I have a data set with a bunch of Numbers and then an user number like eg.below. I want to delete all the characters from "-" and include only the numbers before "-" for each number. Any help with SAS code is much appreciated.

 

Thanks!

 

Number

4050123456-1

4098765478-1

4901898089898999-1

 

Want:

Number_New

4050123456

4098765478

4901898089898999

1 REPLY 1
Tom
Super User Tom
Super User

The SCAN() function will do that.

Number_New = scan(number,1,'-');

Whether you're already using SAS Event Stream Processing or thinking about it, this is where you can connect with your peers, ask questions and find resources.

 

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 545 views
  • 2 likes
  • 2 in conversation