<?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 and macro resolution in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/IF-Statement-and-macro-resolution/m-p/336751#M76370</link>
    <description>&lt;P&gt;You need an 'and', not an 'or' in this statement:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &amp;amp;var ne hand and &amp;amp;var ne eye &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%then&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%do&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 28 Feb 2017 21:43:54 GMT</pubDate>
    <dc:creator>nehalsanghvi</dc:creator>
    <dc:date>2017-02-28T21:43:54Z</dc:date>
    <item>
      <title>%IF Statement and macro resolution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-Statement-and-macro-resolution/m-p/336746#M76366</link>
      <description>&lt;P&gt;&lt;FONT size="3"&gt;I am using a %if statement inside a macro to execute code when &amp;amp;var does NOT match eye or hand. But the code inside the %if is still submitting when it gets to var = eye. How can I write this so that &lt;FONT face="Courier New"&gt;body = &amp;amp;var + &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New"&gt;; &lt;FONT face="arial,helvetica,sans-serif"&gt;does NOT happen when var equals hand or eye?&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; x; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; y;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; look (var);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &amp;amp;var ne hand or &amp;amp;var ne eye &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%then&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%do&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;body = &amp;amp;var + &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%end&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; look;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;look&lt;/I&gt;&lt;/STRONG&gt; (hand);&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;look&lt;/I&gt;&lt;/STRONG&gt; (eye);&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;look&lt;/I&gt;&lt;/STRONG&gt; (arm);&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2017 21:33:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-Statement-and-macro-resolution/m-p/336746#M76366</guid>
      <dc:creator>cruss1</dc:creator>
      <dc:date>2017-02-28T21:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: %IF Statement and macro resolution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-Statement-and-macro-resolution/m-p/336750#M76369</link>
      <description>&lt;P&gt;It looks like a logic error.&amp;nbsp; Your %IF condition must always be true.&amp;nbsp; Change "or" to "and".&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2017 21:43:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-Statement-and-macro-resolution/m-p/336750#M76369</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-02-28T21:43:23Z</dc:date>
    </item>
    <item>
      <title>Re: %IF Statement and macro resolution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-Statement-and-macro-resolution/m-p/336751#M76370</link>
      <description>&lt;P&gt;You need an 'and', not an 'or' in this statement:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &amp;amp;var ne hand and &amp;amp;var ne eye &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%then&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%do&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2017 21:43:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-Statement-and-macro-resolution/m-p/336751#M76370</guid>
      <dc:creator>nehalsanghvi</dc:creator>
      <dc:date>2017-02-28T21:43:54Z</dc:date>
    </item>
    <item>
      <title>Re: %IF Statement and macro resolution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-Statement-and-macro-resolution/m-p/336753#M76371</link>
      <description>&lt;P&gt;The way you have it currently written with an 'or', any &lt;EM&gt;one&lt;/EM&gt; of the two conditions needs to be true for the statement inside to execute. When you pass in hand, &lt;FONT face="Courier New" size="2"&gt;&amp;amp;var ne eye &lt;/FONT&gt;is true, so it executes. When you pass in eye, &lt;FONT face="Courier New" size="2"&gt;&amp;amp;var ne hand &lt;/FONT&gt;is true so it executes. What you intend to say is execute code&amp;nbsp;only if &lt;EM&gt;both&lt;/EM&gt; conditions are true - not hand AND not eye.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &amp;amp;var ne hand and &amp;amp;var ne eye &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%then&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%do&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2017 21:51:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-Statement-and-macro-resolution/m-p/336753#M76371</guid>
      <dc:creator>nehalsanghvi</dc:creator>
      <dc:date>2017-02-28T21:51:08Z</dc:date>
    </item>
  </channel>
</rss>

