BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Riteshdell
Quartz | Level 8

Hello ALL,

 

I have data like in below format in one column.

 

/home
/home/warehouse
/home/warehouse/sasirm
/home/warehouse/sasirm/pa
/home/warehouse/sasirm/report
/sso/transport

 

I want to output as 
home
warehouse
sasirm
pa
report
transport

Please provide me one liner combo function which can manipulate data.

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
data have;
input str $80.;
want=scan(str,-1,'/');
cards;
/home
/home/warehouse
/home/warehouse/sasirm
/home/warehouse/sasirm/pa
/home/warehouse/sasirm/report
/sso/transport
;

View solution in original post

2 REPLIES 2
Ksharp
Super User
data have;
input str $80.;
want=scan(str,-1,'/');
cards;
/home
/home/warehouse
/home/warehouse/sasirm
/home/warehouse/sasirm/pa
/home/warehouse/sasirm/report
/sso/transport
;

Riteshdell
Quartz | Level 8

Thank you, its working.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

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!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 643 views
  • 1 like
  • 2 in conversation