Hi again, Please have a look at the following code. Suffix is removed only for some companies. data word_list;
input word $20.;
if findc(word,"/") then word=tranwrd(word,"/",".");
datalines;
Inc.
Inc
& Co.
Ltd
Ltd.
& Co
& Co Inc
& Co Inc.
& Co, Inc.
& Co, Inc
& Co Ltd
& Co., Ltd
& Co Ltd.
& Co., Ltd.
& Co., Ltd.
L.P.
PLC
LP
LLC
Corp
;
run;
data one;
input lead_managers_name $80.;
datalines;
A. G. Becker Paribas Inc.
A. J. Michaels & Co., Ltd.
A. L. Havens Securities
A. M. Levine
A. T. Brod & Co.
A.R. Baron & Co., Inc.
A.S. Goldmen & Company
AB Capital Markets
ABD Securities
ABN AMRO Chicago Corp
ABN AMRO Incorporated
ABN AMRO Rothschild
ABN-AMRO Holding NV
Access Securities
Acciones y Valores de Mexico
Adams Harkness & Hill Inc
Adams, Cohen
Adams, James & Foor
Advest Inc
Aegis Capital
AG Edwards & Sons Inc
Agean Group Inc
AIB Capital Markets
Akroyd & Smithers Inc
Alan-Bush Brokerage
Alex Brown & Sons Inc
;
run;
proc sql noprint; create table xxx as
select quote(trim(word),"'")
into:word_list separated by ","
from word_list
order by countw(word) desc;
quit;
data want;
set one;
lead_managers_name = tranwrd(lead_managers_name,"/",".");
array _list(&sqlobs) $ _temporary_ (&word_list);
do i=1 to dim(_list);
if find(lead_managers_name,_list(i),"i")>0 then do;
lead_managers_name = prxchange(cats("s/(\(?\b",_list(i),"\b\)?\s*)$//i"),-1,lead_managers_name);
end;
end;
drop i;
run;
... View more