<?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 There is no matching %IF statement for the %ELSE in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/There-is-no-matching-IF-statement-for-the-ELSE/m-p/639594#M190307</link>
    <description>&lt;P&gt;I've googled this issue but I am perplexed by what could be causing it on my end.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code is basically structured like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%MACRO example(var);

%DO j = 1 %TO 10;

    * &amp;lt;insert code that works here&amp;gt;;

    %IF &amp;amp;var=var1 %THEN
           %DO;
      * &amp;lt;insert code that works here&amp;gt;;
           %END;

    %ELSE %IF &amp;amp;var=var2 %THEN
           %DO;&lt;BR /&gt;      * &amp;lt;insert code that works here&amp;gt;;
           %END;
*&amp;lt;insert more code that works here&amp;gt;;

    %IF &amp;amp;var=var1 %THEN
           %DO;&lt;BR /&gt;
      * &amp;lt;insert code that works here&amp;gt;;
&lt;BR /&gt;           %END;

    %ELSE %IF &amp;amp;var=var2 %THEN
           %DO;&lt;BR /&gt;&lt;BR /&gt;      * &amp;lt;insert code that works here&amp;gt;;
&lt;BR /&gt;           %END;

%END;&lt;BR /&gt;&lt;BR /&gt;%MEND&amp;nbsp;example;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;%Example(var1);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;It's annoying because I had some previous variation of this macro working before, then I tried to add a chunk of something else and a second parameter which made it stop working.. Now I can't even get it to work with one parameter.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The weird thing is that the first %IF-THEN-ELSE statement works fine, it's the second&lt;/P&gt;&lt;P&gt;%ELSE %IF statement that gives me the error..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yet, the structure is exactly the same as the first one?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Any ideas?&lt;/P&gt;</description>
    <pubDate>Mon, 13 Apr 2020 22:31:14 GMT</pubDate>
    <dc:creator>UniversitySas</dc:creator>
    <dc:date>2020-04-13T22:31:14Z</dc:date>
    <item>
      <title>There is no matching %IF statement for the %ELSE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/There-is-no-matching-IF-statement-for-the-ELSE/m-p/639594#M190307</link>
      <description>&lt;P&gt;I've googled this issue but I am perplexed by what could be causing it on my end.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code is basically structured like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%MACRO example(var);

%DO j = 1 %TO 10;

    * &amp;lt;insert code that works here&amp;gt;;

    %IF &amp;amp;var=var1 %THEN
           %DO;
      * &amp;lt;insert code that works here&amp;gt;;
           %END;

    %ELSE %IF &amp;amp;var=var2 %THEN
           %DO;&lt;BR /&gt;      * &amp;lt;insert code that works here&amp;gt;;
           %END;
*&amp;lt;insert more code that works here&amp;gt;;

    %IF &amp;amp;var=var1 %THEN
           %DO;&lt;BR /&gt;
      * &amp;lt;insert code that works here&amp;gt;;
&lt;BR /&gt;           %END;

    %ELSE %IF &amp;amp;var=var2 %THEN
           %DO;&lt;BR /&gt;&lt;BR /&gt;      * &amp;lt;insert code that works here&amp;gt;;
&lt;BR /&gt;           %END;

%END;&lt;BR /&gt;&lt;BR /&gt;%MEND&amp;nbsp;example;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;%Example(var1);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;It's annoying because I had some previous variation of this macro working before, then I tried to add a chunk of something else and a second parameter which made it stop working.. Now I can't even get it to work with one parameter.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The weird thing is that the first %IF-THEN-ELSE statement works fine, it's the second&lt;/P&gt;&lt;P&gt;%ELSE %IF statement that gives me the error..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yet, the structure is exactly the same as the first one?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Any ideas?&lt;/P&gt;</description>
      <pubDate>Mon, 13 Apr 2020 22:31:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/There-is-no-matching-IF-statement-for-the-ELSE/m-p/639594#M190307</guid>
      <dc:creator>UniversitySas</dc:creator>
      <dc:date>2020-04-13T22:31:14Z</dc:date>
    </item>
    <item>
      <title>Re: There is no matching %IF statement for the %ELSE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/There-is-no-matching-IF-statement-for-the-ELSE/m-p/639595#M190308</link>
      <description>&lt;P&gt;Looking at your pseudo-code, I doubt we can tell you what is wrong. We would need to see the actual code in order to be able to spot the error. Better yet, show us the ACTUAL log from your code, formatted properly so we can read it by clicking on the &amp;lt;/&amp;gt; icon and pasting the log (as text) into the window that appears. Do no strip out parts of the log. We need to see the code in the log and the warnings and error messages.&lt;/P&gt;
&lt;DIV id="tap-translate"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Mon, 13 Apr 2020 22:35:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/There-is-no-matching-IF-statement-for-the-ELSE/m-p/639595#M190308</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-04-13T22:35:06Z</dc:date>
    </item>
    <item>
      <title>Re: There is no matching %IF statement for the %ELSE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/There-is-no-matching-IF-statement-for-the-ELSE/m-p/639596#M190309</link>
      <description>Okay, it must have been a typo in the second %if-then-else part,&lt;BR /&gt;because I typed it up again, and it works now.&lt;BR /&gt;&lt;BR /&gt;sigh. 1 hour wasted.&lt;BR /&gt;&lt;BR /&gt;Thanks though</description>
      <pubDate>Mon, 13 Apr 2020 22:39:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/There-is-no-matching-IF-statement-for-the-ELSE/m-p/639596#M190309</guid>
      <dc:creator>UniversitySas</dc:creator>
      <dc:date>2020-04-13T22:39:07Z</dc:date>
    </item>
    <item>
      <title>Re: There is no matching %IF statement for the %ELSE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/There-is-no-matching-IF-statement-for-the-ELSE/m-p/639837#M190410</link>
      <description>&lt;P&gt;One thing to be careful of in macros is the style of comment you use. The * &amp;lt;text&amp;gt; ; inside a macro may attempt to execute and things like single quotes ie. * this isn't a good idea; may have interesting results. If the comment is truly a comment not to execute use either the block quote /* &amp;lt;text&amp;gt; */ or the macro quote:&amp;nbsp; %* &amp;lt;text&amp;gt; ; inside macros.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Apr 2020 16:52:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/There-is-no-matching-IF-statement-for-the-ELSE/m-p/639837#M190410</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-04-14T16:52:45Z</dc:date>
    </item>
    <item>
      <title>Re: There is no matching %IF statement for the %ELSE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/There-is-no-matching-IF-statement-for-the-ELSE/m-p/639965#M190462</link>
      <description>I already accepted an answer, but I realized later that what you're saying was the actual cause of the error.&lt;BR /&gt;Thank you!</description>
      <pubDate>Wed, 15 Apr 2020 05:05:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/There-is-no-matching-IF-statement-for-the-ELSE/m-p/639965#M190462</guid>
      <dc:creator>UniversitySas</dc:creator>
      <dc:date>2020-04-15T05:05:07Z</dc:date>
    </item>
  </channel>
</rss>

