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...!
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;
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;
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!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: