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

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

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
  • 705 views
  • 1 like
  • 2 in conversation