<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Finding if values in 1 column are substring of values in 2 column in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Finding-if-values-in-1-column-are-substring-of-values-in-2/m-p/75417#M21874</link>
    <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
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".&lt;BR /&gt;
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.&lt;BR /&gt;
&lt;BR /&gt;
Here is an example&lt;BR /&gt;
&lt;BR /&gt;
Table1&lt;BR /&gt;
Client_name:&lt;BR /&gt;
Walt Disney Corporation&lt;BR /&gt;
Ebay Inc&lt;BR /&gt;
.com Amazon account&lt;BR /&gt;
&lt;BR /&gt;
Table2&lt;BR /&gt;
Advertiser_name:&lt;BR /&gt;
Amazon&lt;BR /&gt;
Disney&lt;BR /&gt;
Ebay&lt;BR /&gt;
&lt;BR /&gt;
The output i need is a 3rd table that would look like this&lt;BR /&gt;
Client_Name Advertiser_Name&lt;BR /&gt;
Walt Disney Corporation Disney&lt;BR /&gt;
Ebay Inc Ebay&lt;BR /&gt;
.com Amazon account Amazon&lt;BR /&gt;
&lt;BR /&gt;
Like %table2.advertiser_Name% would have been great but it seems the like operator only works with a constant.&lt;BR /&gt;
I also tried this statement that did not work either:&lt;BR /&gt;
Create table temp as&lt;BR /&gt;
select t1.Company_name&lt;BR /&gt;
,t2.Advertiser&lt;BR /&gt;
from SSP.SSPClients as t2&lt;BR /&gt;
inner join SSP.Datamart as t1&lt;BR /&gt;
on t1.Company_name like '%' + t2.Advertiser + '%';&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
Company_name and Advertiser are both text fields (length of $44 and $36)&lt;BR /&gt;
&lt;BR /&gt;
Is there any solution to resolve this problem.&lt;BR /&gt;
&lt;BR /&gt;
THANK you SO MUCH for your help. I much appreciate it!&lt;BR /&gt;
Julie</description>
    <pubDate>Sat, 10 Oct 2009 22:45:50 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-10-10T22:45:50Z</dc:date>
    <item>
      <title>Finding if values in 1 column are substring of values in 2 column</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Finding-if-values-in-1-column-are-substring-of-values-in-2/m-p/75417#M21874</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
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".&lt;BR /&gt;
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.&lt;BR /&gt;
&lt;BR /&gt;
Here is an example&lt;BR /&gt;
&lt;BR /&gt;
Table1&lt;BR /&gt;
Client_name:&lt;BR /&gt;
Walt Disney Corporation&lt;BR /&gt;
Ebay Inc&lt;BR /&gt;
.com Amazon account&lt;BR /&gt;
&lt;BR /&gt;
Table2&lt;BR /&gt;
Advertiser_name:&lt;BR /&gt;
Amazon&lt;BR /&gt;
Disney&lt;BR /&gt;
Ebay&lt;BR /&gt;
&lt;BR /&gt;
The output i need is a 3rd table that would look like this&lt;BR /&gt;
Client_Name Advertiser_Name&lt;BR /&gt;
Walt Disney Corporation Disney&lt;BR /&gt;
Ebay Inc Ebay&lt;BR /&gt;
.com Amazon account Amazon&lt;BR /&gt;
&lt;BR /&gt;
Like %table2.advertiser_Name% would have been great but it seems the like operator only works with a constant.&lt;BR /&gt;
I also tried this statement that did not work either:&lt;BR /&gt;
Create table temp as&lt;BR /&gt;
select t1.Company_name&lt;BR /&gt;
,t2.Advertiser&lt;BR /&gt;
from SSP.SSPClients as t2&lt;BR /&gt;
inner join SSP.Datamart as t1&lt;BR /&gt;
on t1.Company_name like '%' + t2.Advertiser + '%';&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
Company_name and Advertiser are both text fields (length of $44 and $36)&lt;BR /&gt;
&lt;BR /&gt;
Is there any solution to resolve this problem.&lt;BR /&gt;
&lt;BR /&gt;
THANK you SO MUCH for your help. I much appreciate it!&lt;BR /&gt;
Julie</description>
      <pubDate>Sat, 10 Oct 2009 22:45:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Finding-if-values-in-1-column-are-substring-of-values-in-2/m-p/75417#M21874</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-10-10T22:45:50Z</dc:date>
    </item>
    <item>
      <title>Re: Finding if values in 1 column are substring of values in 2 column</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Finding-if-values-in-1-column-are-substring-of-values-in-2/m-p/75418#M21875</link>
      <description>Hi:&lt;BR /&gt;
  Take a look at the INDEX, INDEXC, FIND and FINDC functions.&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/62618/HTML/default/a002267763.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/62618/HTML/default/a002267763.htm&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/62618/HTML/default/a000212242.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/62618/HTML/default/a000212242.htm&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/62618/HTML/default/a002264923.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/62618/HTML/default/a002264923.htm&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/62618/HTML/default/a000212237.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/62618/HTML/default/a000212237.htm&lt;/A&gt;&lt;BR /&gt;
            &lt;BR /&gt;
or these have some useful information:&lt;BR /&gt;
&lt;A href="http://www.ats.ucla.edu/stat/sas/faq/index_function.htm" target="_blank"&gt;http://www.ats.ucla.edu/stat/sas/faq/index_function.htm&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://www.nesug.org/Proceedings/nesug01/bt/bt3002.pdf" target="_blank"&gt;http://www.nesug.org/Proceedings/nesug01/bt/bt3002.pdf&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://analytics.ncsu.edu/sesug/2003/SE10-Cassidy.pdf" target="_blank"&gt;http://analytics.ncsu.edu/sesug/2003/SE10-Cassidy.pdf&lt;/A&gt;&lt;BR /&gt;
            &lt;BR /&gt;
cynthia</description>
      <pubDate>Sun, 11 Oct 2009 11:27:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Finding-if-values-in-1-column-are-substring-of-values-in-2/m-p/75418#M21875</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-10-11T11:27:49Z</dc:date>
    </item>
  </channel>
</rss>

