Hi, i need to remove unwanted characters from my 'description column'..please note that the length of the string is not the same on all the rows below. But i only need those last six digits which starts with 1 on an each every row.
Data Have Data Want
Description Description
magma ret3x122354565 190121 190121
buddyoli1234533 180203 180203
brasty omo1903737383 190506 190506
Then simply do
data have;
input description :$&200.;
datalines;
magma ret3x122354565 190121
buddyoli1234533 180203
brasty omo1903737383 190506
;
data want;
set have;
newdecription=scan(description, -1);
run;
Is it always the last part of the string?
That is Correct!
Then simply do
data have;
input description :$&200.;
datalines;
magma ret3x122354565 190121
buddyoli1234533 180203
brasty omo1903737383 190506
;
data want;
set have;
newdecription=scan(description, -1);
run;
Anytime 🙂
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.