<?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 check if the contents of a variable is in another variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/check-if-the-contents-of-a-variable-is-in-another-variable/m-p/433786#M107579</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a sas dataset with 2 variables. I would like to accomplish below. If the value&amp;nbsp;of VAR2 is part of the string in VAR1 FIND needs to be 1, if not 0. How can I do this ? I've been trying out FINDC, CAT, INDEXC but none of these work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;VAR1&lt;/TD&gt;&lt;TD&gt;VAR2&lt;/TD&gt;&lt;TD&gt;FIND&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;\TEST1\IPN R1\2012\2013\CLEARPATH-COMMANDS.TXT&lt;/TD&gt;&lt;TD&gt;IPN R1\2012\DOCUMENT&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;\TEST2\IPN R1\2009\DOCUMENTEN\TRIGGERS DATA_ACCES.TXT&lt;/TD&gt;&lt;TD&gt;IPN R1\2009\DOCUMENT&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;\TEST3\IPN R1\2006\DOCUMENTATION\VIEW SCH_RGL_GPH.SQL&lt;/TD&gt;&lt;TD&gt;IPN R1\2006\DOCUMENT&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
    <pubDate>Sat, 03 Feb 2018 14:08:34 GMT</pubDate>
    <dc:creator>Billybob73</dc:creator>
    <dc:date>2018-02-03T14:08:34Z</dc:date>
    <item>
      <title>check if the contents of a variable is in another variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/check-if-the-contents-of-a-variable-is-in-another-variable/m-p/433786#M107579</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a sas dataset with 2 variables. I would like to accomplish below. If the value&amp;nbsp;of VAR2 is part of the string in VAR1 FIND needs to be 1, if not 0. How can I do this ? I've been trying out FINDC, CAT, INDEXC but none of these work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;VAR1&lt;/TD&gt;&lt;TD&gt;VAR2&lt;/TD&gt;&lt;TD&gt;FIND&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;\TEST1\IPN R1\2012\2013\CLEARPATH-COMMANDS.TXT&lt;/TD&gt;&lt;TD&gt;IPN R1\2012\DOCUMENT&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;\TEST2\IPN R1\2009\DOCUMENTEN\TRIGGERS DATA_ACCES.TXT&lt;/TD&gt;&lt;TD&gt;IPN R1\2009\DOCUMENT&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;\TEST3\IPN R1\2006\DOCUMENTATION\VIEW SCH_RGL_GPH.SQL&lt;/TD&gt;&lt;TD&gt;IPN R1\2006\DOCUMENT&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Sat, 03 Feb 2018 14:08:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/check-if-the-contents-of-a-variable-is-in-another-variable/m-p/433786#M107579</guid>
      <dc:creator>Billybob73</dc:creator>
      <dc:date>2018-02-03T14:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: check if the contents of a variable is in another variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/check-if-the-contents-of-a-variable-is-in-another-variable/m-p/433795#M107582</link>
      <description>&lt;P&gt;Hi&lt;BR /&gt;use find (string , subtring)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the substring has trailing blanks (which is most likely) then there are two options&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;1. Use the t modifier i.e find(string,substring,'t');&lt;/P&gt;&lt;P&gt;2. Use trimn on the substring ie find(string,trimn(substring));&lt;/P&gt;&lt;P&gt;(Use trimn rather than trim in case the substring variable is missing, because trim would return a blank)&lt;/P&gt;</description>
      <pubDate>Sat, 03 Feb 2018 14:59:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/check-if-the-contents-of-a-variable-is-in-another-variable/m-p/433795#M107582</guid>
      <dc:creator>JohnHoughton</dc:creator>
      <dc:date>2018-02-03T14:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: check if the contents of a variable is in another variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/check-if-the-contents-of-a-variable-is-in-another-variable/m-p/433796#M107583</link>
      <description>&lt;P&gt;One slight correction to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/36257"&gt;@JohnHoughton&lt;/a&gt;'s suggestion. Since you want 0s and 1s, use:&lt;/P&gt;
&lt;PRE&gt;find=find(var1,var2,'t') gt 0;&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 03 Feb 2018 15:09:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/check-if-the-contents-of-a-variable-is-in-another-variable/m-p/433796#M107583</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-02-03T15:09:01Z</dc:date>
    </item>
    <item>
      <title>Re: check if the contents of a variable is in another variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/check-if-the-contents-of-a-variable-is-in-another-variable/m-p/433949#M107660</link>
      <description>&lt;P&gt;John and Art,&lt;/P&gt;&lt;P&gt;Thank you very much ! The final solution is :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;find=find(%str(mapbestandsnaam),%str(trimn(stringyeardoc)),'t') gt 0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm surprised this function won't try to resolve &amp;amp; s which are in the paths that I scan. Why is that ?&lt;/P&gt;&lt;P&gt;As you can see I'm using %str.&lt;/P&gt;&lt;P&gt;There can also be quotes and percentage signs in the paths so I would need to use %nrbquote also I guess.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rgds&lt;/P&gt;&lt;P&gt;B&lt;/P&gt;</description>
      <pubDate>Sun, 04 Feb 2018 11:54:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/check-if-the-contents-of-a-variable-is-in-another-variable/m-p/433949#M107660</guid>
      <dc:creator>Billybob73</dc:creator>
      <dc:date>2018-02-04T11:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: check if the contents of a variable is in another variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/check-if-the-contents-of-a-variable-is-in-another-variable/m-p/567306#M159522</link>
      <description>&lt;P&gt;How can I get the find function to work using a field that contains a comma separated list of numbers (i.e&amp;nbsp;610,610,613,614,675,675)?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 14:50:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/check-if-the-contents-of-a-variable-is-in-another-variable/m-p/567306#M159522</guid>
      <dc:creator>satkinson1351</dc:creator>
      <dc:date>2019-06-19T14:50:00Z</dc:date>
    </item>
    <item>
      <title>Re: check if the contents of a variable is in another variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/check-if-the-contents-of-a-variable-is-in-another-variable/m-p/618891#M181613</link>
      <description>&lt;P&gt;if we want exact word match not the character match . how can we do using find ?&lt;/P&gt;&lt;P&gt;ex : var1&amp;nbsp;&lt;/P&gt;&lt;P&gt;awesome customer service today nashville Macys nashvillehospitality raineydayhelp Thanks&lt;/P&gt;&lt;P&gt;var 2&amp;nbsp;&lt;/P&gt;&lt;P&gt;awesome&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;&lt;P&gt;day&lt;/P&gt;&lt;P&gt;help&lt;/P&gt;&lt;P&gt;output: it should consider awesome and Thanks only&amp;nbsp;&lt;/P&gt;&lt;P&gt;please suggest&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 16:36:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/check-if-the-contents-of-a-variable-is-in-another-variable/m-p/618891#M181613</guid>
      <dc:creator>ss171</dc:creator>
      <dc:date>2020-01-21T16:36:41Z</dc:date>
    </item>
    <item>
      <title>Re: check if the contents of a variable is in another variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/check-if-the-contents-of-a-variable-is-in-another-variable/m-p/618913#M181622</link>
      <description>&lt;P&gt;You really ought to start a new thread when asking a new question. However, I think you are looking for the findw function. e.g.:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  informat var1 $200.;
  informat var2 $20.;
  input var1 &amp;amp; var2;
  find=findw(var1,var2,' .,','t');
  cards;
awesome customer service today nashville Macys nashvillehospitality raineydayhelp Thanks  awesome
awesome customer service today nashville Macys nashvillehospitality raineydayhelp Thanks  Thanks
awesome customer service today nashville Macys nashvillehospitality raineydayhelp Thanks  day
awesome customer service today nashville Macys nashvillehospitality raineydayhelp Thanks  help
;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Jan 2020 18:03:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/check-if-the-contents-of-a-variable-is-in-another-variable/m-p/618913#M181622</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2020-01-21T18:03:32Z</dc:date>
    </item>
  </channel>
</rss>

