<?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: Using CONTAINS in an IF statement in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-CONTAINS-in-an-IF-statement/m-p/191525#M14628</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Others have given data step suggestions...you could also use proc sql (especially if the data are in a rdbms somewhere else)...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;select * from have where&lt;/P&gt;&lt;P&gt;TINT='2' and&lt;/P&gt;&lt;P&gt;( NAME like '% TRUST %' or name like&amp;nbsp; '% TR %');&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 21 Oct 2014 12:33:35 GMT</pubDate>
    <dc:creator>DBailey</dc:creator>
    <dc:date>2014-10-21T12:33:35Z</dc:date>
    <item>
      <title>Using CONTAINS in an IF statement</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-CONTAINS-in-an-IF-statement/m-p/191521#M14624</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to find a way to find character fields that contains some special keywords.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried using something like this:&lt;/P&gt;&lt;P&gt;IF TINT='2' and NAME CONTAINS (' TRUST ', ' TR ');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="102" style="border: 1px solid rgb(0, 0, 0); width: 408px; height: 104px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;TINT&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;NAME&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;JOSEPH BROWN TRUST&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;THE TRUSTWORTHDY TRUST CORP&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;JOHN ADAMS TR&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to find a way to identify , in this example, the last two observations because they meet the conditions I listed on the IF statement.&amp;nbsp; I do have millions of records, so this is just an example. Any ideas how to make this easy?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Oct 2014 20:06:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-CONTAINS-in-an-IF-statement/m-p/191521#M14624</guid>
      <dc:creator>ismahero2</dc:creator>
      <dc:date>2014-10-20T20:06:30Z</dc:date>
    </item>
    <item>
      <title>Re: Using CONTAINS in an IF statement</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-CONTAINS-in-an-IF-statement/m-p/191522#M14625</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt;IF TINT='2' &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt;&amp;nbsp; and ( INDEXW( NAME,'TRUST')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; or&amp;nbsp; INDEXW( NAME,'TR')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Oct 2014 20:20:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-CONTAINS-in-an-IF-statement/m-p/191522#M14625</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-10-20T20:20:17Z</dc:date>
    </item>
    <item>
      <title>Re: Using CONTAINS in an IF statement</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-CONTAINS-in-an-IF-statement/m-p/191523#M14626</link>
      <description>&lt;P&gt;How many key "words" are you needing to search for? You aren't going to find a list type function though it may be possible to write one.&lt;/P&gt;
&lt;P&gt;FINDW lets you specify only to match words, which are separated by delimiters such as a space so you do not need to try to specify a search string such as ' TR ' with spaces to find the TR at the end of line 3 but not match if in the middle of a word.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if tint='2' then do;
/* multiple individual searches*/
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if findw(name,'TRUST')&amp;gt;0 then do; &amp;lt;whatever&amp;gt;; end;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if findw(name,'TR')&amp;gt;0 then do; &amp;lt;whatever&amp;gt;; end;
end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13871"&gt;@DBailey&lt;/a&gt;:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Others have given data step suggestions...you could also use proc sql (especially if the data are in a rdbms somewhere else)...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select * from have where
TINT='2' and
( NAME like '% TRUST %' or name like&amp;nbsp; '% TR %');
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Mon, 03 Jul 2017 13:41:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-CONTAINS-in-an-IF-statement/m-p/191523#M14626</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-07-03T13:41:02Z</dc:date>
    </item>
    <item>
      <title>Re: Using CONTAINS in an IF statement</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-CONTAINS-in-an-IF-statement/m-p/191524#M14627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data want(drop=_name keywords);&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;_NAME=NAME;&lt;/P&gt;&lt;P&gt;length keywords $20;&lt;/P&gt;&lt;P&gt;do keywords='TRUST', 'TR';&lt;/P&gt;&lt;P&gt; _NAME = tranwrd(_NAME,strip(keywords),'***');&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;if TINT=2 and findw(_name,'***');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Oct 2014 21:01:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-CONTAINS-in-an-IF-statement/m-p/191524#M14627</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-10-20T21:01:59Z</dc:date>
    </item>
    <item>
      <title>Re: Using CONTAINS in an IF statement</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-CONTAINS-in-an-IF-statement/m-p/191525#M14628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Others have given data step suggestions...you could also use proc sql (especially if the data are in a rdbms somewhere else)...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;select * from have where&lt;/P&gt;&lt;P&gt;TINT='2' and&lt;/P&gt;&lt;P&gt;( NAME like '% TRUST %' or name like&amp;nbsp; '% TR %');&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Oct 2014 12:33:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-CONTAINS-in-an-IF-statement/m-p/191525#M14628</guid>
      <dc:creator>DBailey</dc:creator>
      <dc:date>2014-10-21T12:33:35Z</dc:date>
    </item>
    <item>
      <title>Re: Using CONTAINS in an IF statement</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-CONTAINS-in-an-IF-statement/m-p/191526#M14629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;IF TINT='2'&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;&amp;nbsp; and&amp;nbsp; prxmatch('/&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt;TRUST&lt;/SPAN&gt;|&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt;TR&lt;/SPAN&gt;/',NAME)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Oct 2014 13:52:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-CONTAINS-in-an-IF-statement/m-p/191526#M14629</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-10-21T13:52:12Z</dc:date>
    </item>
  </channel>
</rss>

