Help using Base SAS procedures

Finding if values in 1 column are substring of values in 2 column

Reply
N/A
Posts: 0

Finding if values in 1 column are substring of values in 2 column

Hi,

I'm new on this forum and quite new with SAS coding too, so thanks for your help and your kind understanding of my "ignorance".
I am trying to link table 1 (1 column called client_name) to table 2 (1 column called advertiser_name) where table 2 contains a list of 5000 terms that could (or could not) be embedded into any of the client_names in table 1.

Here is an example

Table1
Client_name:
Walt Disney Corporation
Ebay Inc
.com Amazon account

Table2
Advertiser_name:
Amazon
Disney
Ebay

The output i need is a 3rd table that would look like this
Client_Name Advertiser_Name
Walt Disney Corporation Disney
Ebay Inc Ebay
.com Amazon account Amazon

Like %table2.advertiser_Name% would have been great but it seems the like operator only works with a constant.
I also tried this statement that did not work either:
Create table temp as
select t1.Company_name
,t2.Advertiser
from SSP.SSPClients as t2
inner join SSP.Datamart as t1
on t1.Company_name like '%' + t2.Advertiser + '%';
quit;

Company_name and Advertiser are both text fields (length of $44 and $36)

Is there any solution to resolve this problem.

THANK you SO MUCH for your help. I much appreciate it!
Julie
Ask a Question
Discussion stats
  • 1 reply
  • 93 views
  • 0 likes
  • 2 in conversation