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

Hi Everyone,

I need help on below requirement.

 

I have list of Names in dataset, Name contains multiple tokens separated by space.

Need to split name field and arrenge in proper format.

 

Ex- Input data.

Sl No Company Name
1 NSDL PVT LTD
2 CIBIL INDIA LIMITED
3 EQUIFAX INTERNATIONAL LTD
4 HIGMMARK PRIVATE LIMITED
5 EXPERIAN LTD

 

Out put should be :- 

Sl No TOKEN
1 NSDL
1 PVT
1 LTD
2 CIBIL
2 INDIA
2 LIMITED
3 EQUIFAX
3 INTERNATIONAL
3 LTD
4 HIGHMARK
4 PRIVATE
4 LIMITED
5 EXPERIAN
5 LTD

 

Thanks in Advance...!

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
data have;
infile cards truncover expandtabs;
input SlNo	CompanyName $40.;
cards;
1	NSDL PVT LTD
2	CIBIL INDIA LIMITED
3	EQUIFAX INTERNATIONAL LTD
4	HIGMMARK PRIVATE LIMITED
5	EXPERIAN LTD
;
run;
data want;
 set have;
 do i=1 to countw(CompanyName,' ');
  token=scan(CompanyName,i);output;
 end;
 drop i;
run;

View solution in original post

2 REPLIES 2
Ksharp
Super User
data have;
infile cards truncover expandtabs;
input SlNo	CompanyName $40.;
cards;
1	NSDL PVT LTD
2	CIBIL INDIA LIMITED
3	EQUIFAX INTERNATIONAL LTD
4	HIGMMARK PRIVATE LIMITED
5	EXPERIAN LTD
;
run;
data want;
 set have;
 do i=1 to countw(CompanyName,' ');
  token=scan(CompanyName,i);output;
 end;
 drop i;
run;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1212 views
  • 2 likes
  • 2 in conversation