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;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.