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 Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 351 views
  • 1 like
  • 2 in conversation
OSZAR »