Dear all,
I would like to replace “LIMITED” with “LTD”, “SOCIETE ANONYME” with “SA”.
NAME
DYNAMIC COMMERCIAL FINANCE PLC,
MTR CORPORATION LIMITED,
INTERCEDE GROUP SOCIETE ANONYME
as
NAME
DYNAMIC COMMERCIAL FINANCE PLC,
MTR CORPORATION LTD,
INTERCEDE GROUP SA
could you please give me some suggestion about it?
thanks in advance
Tranwrd:
http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000215027.htm
Perl regular expressions. Findw/substr. Other string functions.
Dear RW9,
thank you for your advice.
I have tried to use,
data sa_step3.Data_UK_companies_try1;
set sa_step3.Datastream_UK_public_companies;
NAME1=tranwrd(COMPANY_NAME, "LIMITED", "LTD");
NAME1=tranwrd(COMPANY_NAME, "SOCIETE ANONYME", "SA");
put NAME1;
run;
However, I did not get the variable. Could you please give some suggestions in detail.
thanks in advance.
Its really not possible to answer from "However, I did not get the variable. ". What didn't happen? Post test data in the form of a datastep - this is so we can see what your working with. The code:
data temp; company_name="Somewhere LIMITED company"; name1=tranwrd(company_name,"LIMITED","LTD"); name1=tranwrd(name1,"SOCIETE ANONYME","SA"); run;
Works fine. Note that the second tranwrd should use the name1 variable and from there on in.
@France wrote:
Dear Reeza,
thanks for your kind advice.
what I am doing is to match two databases by the companies' name (PATSTAT database and Datastream database). I did not find any identifier for both of them yet. so I have to standardise the companies' name and match them together. is there any method I can use to match successfully.
Not really. I tried this last year and the best we could do was about 60% and that was after cleaning up all the LTD, CO and such. Company names are ugly and convoluted and they have too many subsidiaries with similar names to be reliable when matched.
Hello,
I make this solution with macro
option symbolgen mprint mlogic;
DATA test;
infile cards dsd truncover;
INPUT subject $100. ;
CARDS;
NAME
DYNAMIC COMMERCIAL FINANCE PLC
MTR CORPORATION LIMITED
INTERCEDE GROUP SOCIETE ANONYME
;
run;
%let var_have =LIMITED,SOCIETE ANONYME ;
%let var_change=LTD ,SA ;
%macro test();
data test;
set test;
%let i=1;
%do %while(%length(%scan(%quote(&var_have), &i, %str(,)))>0);
subject=tranwrd(subject, scan("&var_have",&i, ',') , scan("&var_change",&i, ',' ) );
%let i=%eval(&i+1);
%end;
run;
%mend test;
%test;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.