<?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: IF STATEMENT comparing one to many in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-STATEMENT-comparing-one-to-many/m-p/149351#M11732</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You don't give many details.&amp;nbsp; For instance is it a character to character check, then maybe:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where catx(',',of control1-control21) not contains xyz;&lt;/P&gt;&lt;P&gt;I.e. if the string in variable xyz does not appear in a concatenation of all the others.&lt;/P&gt;&lt;P&gt;You could also do arrays:&lt;/P&gt;&lt;P&gt;array control{21};&lt;/P&gt;&lt;P&gt;do I=1 to 21;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if xyz=control{I} then found=1;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;if found=0 then ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could generate the code from a data _null_ using call execute, you could create a macro etc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 30 Oct 2014 13:04:47 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2014-10-30T13:04:47Z</dc:date>
    <item>
      <title>IF STATEMENT comparing one to many</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-STATEMENT-comparing-one-to-many/m-p/149350#M11731</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 have one variable I want to compare to 21 others.&amp;nbsp; I only want IF the variable CONTROL NOT EQUALS variables CONTROL1 to CONTROL21.&amp;nbsp; Anyone has a better, simpler way of doing it than this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF CONTROL NE CONTROL1 AND CONTROL NE CONTROL2 AND CONTROL NE CONTROL3 AND CONTROL NE CONTROL 4.................. AND&amp;nbsp; CONTROL&amp;nbsp; NE CONTROL 21;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for the help;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ismael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Oct 2014 12:53:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-STATEMENT-comparing-one-to-many/m-p/149350#M11731</guid>
      <dc:creator>ismahero2</dc:creator>
      <dc:date>2014-10-30T12:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: IF STATEMENT comparing one to many</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-STATEMENT-comparing-one-to-many/m-p/149351#M11732</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You don't give many details.&amp;nbsp; For instance is it a character to character check, then maybe:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where catx(',',of control1-control21) not contains xyz;&lt;/P&gt;&lt;P&gt;I.e. if the string in variable xyz does not appear in a concatenation of all the others.&lt;/P&gt;&lt;P&gt;You could also do arrays:&lt;/P&gt;&lt;P&gt;array control{21};&lt;/P&gt;&lt;P&gt;do I=1 to 21;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if xyz=control{I} then found=1;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;if found=0 then ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could generate the code from a data _null_ using call execute, you could create a macro etc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Oct 2014 13:04:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-STATEMENT-comparing-one-to-many/m-p/149351#M11732</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-10-30T13:04:47Z</dc:date>
    </item>
    <item>
      <title>Re: IF STATEMENT comparing one to many</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-STATEMENT-comparing-one-to-many/m-p/149352#M11733</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ... try this ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;data test;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;input control control1-control5;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;datalines;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;1 1 2 3 4 5&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;2 9 9 9 9 9&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;5 9 9 9 9 5&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;9 1 2 9 9 9&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;8 1 1 1 1 1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;data new;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;set test;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;array x(5) control1-control5;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;if control not in x;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ps&amp;nbsp; Learned about this use of an array from Ksharp a while back.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Oct 2014 17:09:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-STATEMENT-comparing-one-to-many/m-p/149352#M11733</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2014-10-30T17:09:00Z</dc:date>
    </item>
    <item>
      <title>Re: IF STATEMENT comparing one to many</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-STATEMENT-comparing-one-to-many/m-p/149353#M11734</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&amp;nbsp; Re ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"For instance is it a character to character check, then maybe:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where catx(',',of control1-control21) not contains xyz;"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The CAT functions can be used with both CHARACTER and NUMERIC variables, for example ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;data test;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;input control control1-control5;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;datalines;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;1 1 2 3 4 5&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;2 9 9 9 9 9&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;5 9 9 9 9 5&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;9 1 2 9 9 9&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;8 1 1 1 1 1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;data new;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;set test;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;if ^find(cat(of control1-control5), cat(control));&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;works with no annoying messages in the LOG.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ps ... Searching for Variable Values with CAT Functions: An Alternative to Arrays and Loops&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.nesug.org/Proceedings/nesug09/ff/ff04.pdf" title="http://www.nesug.org/Proceedings/nesug09/ff/ff04.pdf"&gt;http://www.nesug.org/Proceedings/nesug09/ff/ff04.pdf&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Oct 2014 17:25:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-STATEMENT-comparing-one-to-many/m-p/149353#M11734</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2014-10-30T17:25:10Z</dc:date>
    </item>
    <item>
      <title>Re: IF STATEMENT comparing one to many</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-STATEMENT-comparing-one-to-many/m-p/149354#M11735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if whichn(control, of control1-control21) &amp;gt; 0; /* if NUMERIC */&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if whichc(control, of control1-control21) &amp;gt; 0; /* if CHARACTER */&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Oct 2014 18:08:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-STATEMENT-comparing-one-to-many/m-p/149354#M11735</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2014-10-30T18:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: IF STATEMENT comparing one to many</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-STATEMENT-comparing-one-to-many/m-p/149355#M11736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nice ... would just change &amp;gt; 0 to eq 0 since looking for observations where CONTROL is NOT EQUAL to any of CONTOL1-CONTROL5, yes/no?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Oct 2014 18:22:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-STATEMENT-comparing-one-to-many/m-p/149355#M11736</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2014-10-30T18:22:24Z</dc:date>
    </item>
    <item>
      <title>Re: IF STATEMENT comparing one to many</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-STATEMENT-comparing-one-to-many/m-p/149356#M11737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Right! &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Oct 2014 18:41:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-STATEMENT-comparing-one-to-many/m-p/149356#M11737</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2014-10-30T18:41:41Z</dc:date>
    </item>
    <item>
      <title>Re: IF STATEMENT comparing one to many</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-STATEMENT-comparing-one-to-many/m-p/149357#M11738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mike,&lt;/P&gt;&lt;P&gt;Actually , I learned it from data _null_; &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Oct 2014 08:25:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-STATEMENT-comparing-one-to-many/m-p/149357#M11738</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-10-31T08:25:54Z</dc:date>
    </item>
  </channel>
</rss>

