<?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 Re: Match observations contain in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Match-observations-contain/m-p/534406#M6320</link>
    <description>&lt;P&gt;How similar?&amp;nbsp; How much data?&amp;nbsp; For a small amount of data you could just merge (or join) the smaller data on and do an if set or index function on it.&amp;nbsp; If its larger data then it would be highly beneficial to split the nameO column up into individual elements rather than having multiple items in one column - its always a good idea to have only one item per column anyways.&amp;nbsp; For large data you could also do:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  set small end=last;
  if _n_=1 then call execute('data want; set large;');
  call execute(cats('if index(nameo,"',name,'") then output;'));
  if last then call execute('run;');
run;&lt;/PRE&gt;
&lt;P&gt;That would generate a datastep with an if for each element in the smaller datastep.&amp;nbsp; But I would really advise to split that data up.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 11 Feb 2019 09:21:24 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2019-02-11T09:21:24Z</dc:date>
    <item>
      <title>Match observations contain</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Match-observations-contain/m-p/534388#M6316</link>
      <description>&lt;P&gt;I have two data sets as following below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data set 1 is a list of company names.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Name&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;Apple&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;Google&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#99CC00"&gt;Amazon&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data set 2 has the following variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Year1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;USname&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;nameO&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Country&amp;nbsp; &amp;nbsp; Year2&lt;/P&gt;&lt;P&gt;01&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1992&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Apple&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;FONT color="#FF0000"&gt;Apple&lt;/FONT&gt; | Ford&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;US&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1993&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;02&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1993&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Alphabet&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Toyato |&lt;FONT color="#99CC00"&gt; Amazon&lt;/FONT&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;US&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1995&lt;/P&gt;&lt;P&gt;03&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1994&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Amazon.com&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;FONT color="#99CC00"&gt;Amazon&amp;nbsp;&lt;/FONT&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;US&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1996&lt;/P&gt;&lt;P&gt;04&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1995&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Alphabet&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;FONT color="#0000FF"&gt;Google&lt;/FONT&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; US&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1997&lt;/P&gt;&lt;P&gt;05&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1996&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IBM&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;IBM&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;US&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1998&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Name in data set 1 is the same with nameO in data set 2 (Google) or Name in data set1 is partly same with nameO in data set 2 (Apple).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want is to match these two data sets as long as NameO is partly same with Name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Expected&lt;/P&gt;&lt;P&gt;ID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Year1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;USname&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;nameO&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Country&amp;nbsp; &amp;nbsp; Year2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;name&lt;/P&gt;&lt;P&gt;01&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1992&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Apple&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;FONT color="#FF0000"&gt;Apple&lt;/FONT&gt; | Ford&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;US&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1993&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Apple&lt;/P&gt;&lt;P&gt;02&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1993&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Alphabet&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Toyato |&lt;FONT color="#99CC00"&gt; Amazon&lt;/FONT&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;US&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1995&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Amazon&lt;/P&gt;&lt;P&gt;03&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1994&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Amazon.com&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;FONT color="#99CC00"&gt;Amazon&amp;nbsp;&lt;/FONT&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;US&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1996&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Amazon&lt;/P&gt;&lt;P&gt;04&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1995&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Alphabet&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;FONT color="#0000FF"&gt;Google&lt;/FONT&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; US&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1997&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Google&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What code do I need to use? Thanks a lot!&lt;/P&gt;</description>
      <pubDate>Mon, 11 Feb 2019 06:59:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Match-observations-contain/m-p/534388#M6316</guid>
      <dc:creator>dapenDaniel</dc:creator>
      <dc:date>2019-02-11T06:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: Match observations contain</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Match-observations-contain/m-p/534406#M6320</link>
      <description>&lt;P&gt;How similar?&amp;nbsp; How much data?&amp;nbsp; For a small amount of data you could just merge (or join) the smaller data on and do an if set or index function on it.&amp;nbsp; If its larger data then it would be highly beneficial to split the nameO column up into individual elements rather than having multiple items in one column - its always a good idea to have only one item per column anyways.&amp;nbsp; For large data you could also do:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  set small end=last;
  if _n_=1 then call execute('data want; set large;');
  call execute(cats('if index(nameo,"',name,'") then output;'));
  if last then call execute('run;');
run;&lt;/PRE&gt;
&lt;P&gt;That would generate a datastep with an if for each element in the smaller datastep.&amp;nbsp; But I would really advise to split that data up.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Feb 2019 09:21:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Match-observations-contain/m-p/534406#M6320</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2019-02-11T09:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: Match observations contain</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Match-observations-contain/m-p/534433#M6328</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
input Name $;
cards;
Apple
Google
Amazon
;

data b;
input ID           Year1       USname   : $20.          nameO   &amp;amp; $20.         Country  $  Year2;
cards;
01           1992          Apple                 Apple | Ford                             US          1993     
02           1993         Alphabet            Toyato | Amazon                       US          1995
03           1994       Amazon.com       Amazon                                     US          1996
04           1995         Alphabet            Google                                      US           1997
05           1996          IBM                     IBM                                         US            1998
;


proc sql;
select *
 from b inner join a 
  on b.nameO contains strip(a.name);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Feb 2019 12:34:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Match-observations-contain/m-p/534433#M6328</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-02-11T12:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: Match observations contain</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Match-observations-contain/m-p/534632#M6356</link>
      <description>&lt;P&gt;Thanks for your answer. There is another problem.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In data a, Names are using the upper case such as "APPLE" and NameO in data b are using lower case such as "apple" or "Apple". I found that "APPLE" in data a cannot be matched with "apple" in data b.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any way to ignore the lower case or upper case? Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Feb 2019 21:45:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Match-observations-contain/m-p/534632#M6356</guid>
      <dc:creator>dapenDaniel</dc:creator>
      <dc:date>2019-02-11T21:45:25Z</dc:date>
    </item>
    <item>
      <title>Re: Match observations contain</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Match-observations-contain/m-p/534756#M6369</link>
      <description>&lt;P&gt;Use upper or lower functions:&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;  on lower(b&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;nameO) contains &lt;SPAN class="token function"&gt;strip&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(lower(&lt;/SPAN&gt;a&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;name)&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then all text compares will be low case.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Feb 2019 09:34:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Match-observations-contain/m-p/534756#M6369</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2019-02-12T09:34:45Z</dc:date>
    </item>
  </channel>
</rss>

