<?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 %IF not working in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-not-working/m-p/249189#M17649</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I've been trying to do the following however the macro that I create with the IF statement fails to work. Can someone tell me what I'm doing wrong:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let type=motor;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt; &lt;STRONG&gt;&lt;EM&gt;test3&lt;/EM&gt;&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;%if &amp;amp;type=motor %then %let type1=car;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;EM&gt;test3&lt;/EM&gt;&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;%put &amp;amp;type1.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Wed, 10 Feb 2016 14:26:29 GMT</pubDate>
    <dc:creator>aryu</dc:creator>
    <dc:date>2016-02-10T14:26:29Z</dc:date>
    <item>
      <title>%IF not working</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-not-working/m-p/249189#M17649</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I've been trying to do the following however the macro that I create with the IF statement fails to work. Can someone tell me what I'm doing wrong:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let type=motor;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt; &lt;STRONG&gt;&lt;EM&gt;test3&lt;/EM&gt;&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;%if &amp;amp;type=motor %then %let type1=car;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;EM&gt;test3&lt;/EM&gt;&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;%put &amp;amp;type1.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2016 14:26:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-not-working/m-p/249189#M17649</guid>
      <dc:creator>aryu</dc:creator>
      <dc:date>2016-02-10T14:26:29Z</dc:date>
    </item>
    <item>
      <title>Re: %IF not working</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-not-working/m-p/249192#M17650</link>
      <description>&lt;P&gt;Macro variables don't last forever.&amp;nbsp; Your new variable TYPE1 is automatically deleted once your macro finishes executing.&amp;nbsp; You have a couple of ways to change the result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could define TYPE1 as global, meaning it will last after the macro finishes.&amp;nbsp; To do that, add this statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%global type1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could add it either before running the macro, or inside the macro but before the %IF statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternatively, you could move the %PUT statement inside the macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2016 14:37:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-not-working/m-p/249192#M17650</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-02-10T14:37:11Z</dc:date>
    </item>
    <item>
      <title>Re: %IF not working</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-not-working/m-p/249193#M17651</link>
      <description>&lt;P&gt;Thanks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; worked perfectly.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2016 14:48:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-not-working/m-p/249193#M17651</guid>
      <dc:creator>aryu</dc:creator>
      <dc:date>2016-02-10T14:48:24Z</dc:date>
    </item>
  </channel>
</rss>

