<?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: find function in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/find-function/m-p/321413#M70966</link>
    <description>&lt;P&gt;Here is my test code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data testFile;&lt;BR /&gt;length col1 $20 col2 $20;&lt;BR /&gt;input col1 $ col2 $;&lt;BR /&gt;datalines;&lt;BR /&gt;ICORK CORK&lt;BR /&gt;CORK DUBLIN&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data testFind;&lt;BR /&gt;set testFile;&lt;BR /&gt;put col1= col2=;&lt;BR /&gt;test = find(col1,col2);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and is find() does not find CORK in ICORK&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you have an idea why?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thansks,&lt;/P&gt;&lt;P&gt;Thierry&lt;/P&gt;</description>
    <pubDate>Wed, 28 Dec 2016 11:21:25 GMT</pubDate>
    <dc:creator>valleet</dc:creator>
    <dc:date>2016-12-28T11:21:25Z</dc:date>
    <item>
      <title>find function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/find-function/m-p/321409#M70963</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to use the use the find() function in SAS Enterprise 5.1.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It does not work as specified in all the literature I found on the web. It is only able to find perfect matches between two&lt;/P&gt;&lt;P&gt;strings. For instance, it return 1 on find(col1,col2) when col1 contains "CORK" and col2 "CORK", but 0 when col1 contains&lt;/P&gt;&lt;P&gt;"ICORK" and col2 contains "CORK".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone explain why find() has the behavior ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Thierry&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Dec 2016 11:08:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/find-function/m-p/321409#M70963</guid>
      <dc:creator>valleet</dc:creator>
      <dc:date>2016-12-28T11:08:47Z</dc:date>
    </item>
    <item>
      <title>Re: find function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/find-function/m-p/321411#M70965</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It works as explained in the documentation:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002267763.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002267763.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The following example returns &lt;STRONG&gt;z=2 &lt;/STRONG&gt; in the log.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
col1='ICORK';
col2='CORK';
z=find(col1,col2);

put z=;

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Dec 2016 11:15:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/find-function/m-p/321411#M70965</guid>
      <dc:creator>Loko</dc:creator>
      <dc:date>2016-12-28T11:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: find function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/find-function/m-p/321413#M70966</link>
      <description>&lt;P&gt;Here is my test code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data testFile;&lt;BR /&gt;length col1 $20 col2 $20;&lt;BR /&gt;input col1 $ col2 $;&lt;BR /&gt;datalines;&lt;BR /&gt;ICORK CORK&lt;BR /&gt;CORK DUBLIN&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data testFind;&lt;BR /&gt;set testFile;&lt;BR /&gt;put col1= col2=;&lt;BR /&gt;test = find(col1,col2);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and is find() does not find CORK in ICORK&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you have an idea why?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thansks,&lt;/P&gt;&lt;P&gt;Thierry&lt;/P&gt;</description>
      <pubDate>Wed, 28 Dec 2016 11:21:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/find-function/m-p/321413#M70966</guid>
      <dc:creator>valleet</dc:creator>
      <dc:date>2016-12-28T11:21:25Z</dc:date>
    </item>
    <item>
      <title>Re: find function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/find-function/m-p/321414#M70967</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Providing the substring (in your ex. col2) in the form of a variable means SAS adds the spaces which fill in the variable until thje length provided (in your example 20).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Adjusting the code to &lt;STRONG&gt;test = find(col1,trim(col2)); &lt;/STRONG&gt;will do it .&lt;/P&gt;</description>
      <pubDate>Wed, 28 Dec 2016 11:45:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/find-function/m-p/321414#M70967</guid>
      <dc:creator>Loko</dc:creator>
      <dc:date>2016-12-28T11:45:11Z</dc:date>
    </item>
  </channel>
</rss>

