<?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: SAS Macro %if %then %do %else %do in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-if-then-do-else-do/m-p/487486#M127041</link>
    <description>Reeza,&lt;BR /&gt;&lt;BR /&gt;OR option worked. The other option minoperator mindelimiter=',' generated the following errors;&lt;BR /&gt;&lt;BR /&gt;ERROR: The /MINDELIMITER= option must be a single character enclosed in single quotation marks.&lt;BR /&gt;ERROR: A dummy macro will be compiled.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Thu, 16 Aug 2018 15:49:16 GMT</pubDate>
    <dc:creator>park2039</dc:creator>
    <dc:date>2018-08-16T15:49:16Z</dc:date>
    <item>
      <title>SAS Macro %if %then %do %else %do</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-if-then-do-else-do/m-p/487474#M127033</link>
      <description>&lt;DIV style="margin-top: 0px; margin-bottom: 0px;"&gt;&lt;FONT face="r_ansi" size="2"&gt;I am&amp;nbsp;trying to execute the following macro.&amp;nbsp;Can someone explain why both conditions at the bottom are FALSE?&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV style="margin-top: 0px; margin-bottom: 0px;"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="margin-top: 0px; margin-bottom: 0px;"&gt;&lt;FONT face="r_ansi" size="2"&gt;Thanks&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV style="margin-top: 0px; margin-bottom: 0px;"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="margin-top: 0px; margin-bottom: 0px;"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="margin-top: 0px; margin-bottom: 0px;"&gt;&lt;FONT face="r_ansi" size="2"&gt;%macro run_mig (yr);&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV style="margin-top: 0px; margin-bottom: 0px;"&gt;&lt;FONT face="r_ansi" size="2"&gt;data one;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV style="margin-top: 0px; margin-bottom: 0px;"&gt;&lt;FONT face="r_ansi" size="2"&gt;&amp;nbsp;%if &amp;amp;yr in (2015,2016) %then %do;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV style="margin-top: 0px; margin-bottom: 0px;"&gt;&lt;FONT face="r_ansi" size="2"&gt;&amp;nbsp; set "/y/x/&amp;amp;yr/vs&amp;amp;yr._1yr" ;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV style="margin-top: 0px; margin-bottom: 0px;"&gt;&lt;FONT face="r_ansi" size="2"&gt;&amp;nbsp;%end;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV style="margin-top: 0px; margin-bottom: 0px;"&gt;&lt;FONT face="r_ansi" size="2"&gt;&amp;nbsp;%else %if &amp;amp;yr le 2014 %then %do;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV style="margin-top: 0px; margin-bottom: 0px;"&gt;&lt;FONT face="r_ansi" size="2"&gt;&amp;nbsp; set "/y/x/&amp;amp;yr/data/vpers&amp;amp;yr._1yr" ;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV style="margin-top: 0px; margin-bottom: 0px;"&gt;&lt;FONT face="r_ansi" size="2"&gt;&amp;nbsp;%end;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV style="margin-top: 0px; margin-bottom: 0px;"&gt;&lt;FONT face="r_ansi" size="2"&gt;run;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV style="margin-top: 0px; margin-bottom: 0px;"&gt;&lt;FONT face="r_ansi" size="2"&gt;%mend;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV style="margin-top: 0px; margin-bottom: 0px;"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="margin-top: 0px; margin-bottom: 0px;"&gt;&lt;FONT face="r_ansi" size="2"&gt;%run_mig(2015);&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV style="margin-top: 0px; margin-bottom: 0px;"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="margin-top: 0px; margin-bottom: 0px;"&gt;&lt;FONT face="r_ansi" size="2"&gt;MLOGIC(RUN_MIG): Beginning execution.&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV style="margin-top: 0px; margin-bottom: 0px;"&gt;&lt;FONT face="r_ansi" size="2"&gt;MLOGIC(RUN_MIG): Parameter YR has value 2015 &lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV style="margin-top: 0px; margin-bottom: 0px;"&gt;&lt;FONT face="r_ansi" size="2"&gt;MPRINT(RUN_MIG): data one;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV style="margin-top: 0px; margin-bottom: 0px;"&gt;&lt;FONT face="r_ansi" size="2"&gt;MLOGIC(RUN_MIG): %IF condition &amp;amp;yr in (2015,2016) is FALSE&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV style="margin-top: 0px; margin-bottom: 0px;"&gt;&lt;FONT face="r_ansi" size="2"&gt;MLOGIC(RUN_MIG): %IF condition &amp;amp;yr le 2014 is FALSE&lt;/FONT&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 16 Aug 2018 15:24:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-if-then-do-else-do/m-p/487474#M127033</guid>
      <dc:creator>park2039</dc:creator>
      <dc:date>2018-08-16T15:24:54Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro %if %then %do %else %do</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-if-then-do-else-do/m-p/487477#M127034</link>
      <description>&lt;P&gt;IN doesn't always work as expected with the logic.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can enable it using MINOPERATOR.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro run_mig(yr) / minoperator mindelimiter=',';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or use OR&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; %if &amp;amp;yr=2015 or &amp;amp;yr=2016 %then %do;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/62978/HTML/default/viewer.htm#p0pbehl7wj5sl4n1ov1ortnehtba.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/62978/HTML/default/viewer.htm#p0pbehl7wj5sl4n1ov1ortnehtba.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Aug 2018 15:34:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-if-then-do-else-do/m-p/487477#M127034</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-08-16T15:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro %if %then %do %else %do</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-if-then-do-else-do/m-p/487478#M127035</link>
      <description>&lt;P&gt;I think the default delimiter for the in operator in macros is the space.&lt;/P&gt;
&lt;P&gt;Try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;option mindelimiter=",";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Aug 2018 15:34:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-if-then-do-else-do/m-p/487478#M127035</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2018-08-16T15:34:44Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro %if %then %do %else %do</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-if-then-do-else-do/m-p/487480#M127036</link>
      <description>&lt;P&gt;Using the IN operator in macro language is tricky, and requires the proper setting for two options, and possibly a slightly different syntax.&amp;nbsp; While you can look them up if you would (start with MINDELIMITER), it's easier to just get rid of IN for two possible values:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%if &amp;amp;yr=2015 or &amp;amp;yr=2016 %then %do;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Aug 2018 15:35:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-if-then-do-else-do/m-p/487480#M127036</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-08-16T15:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro %if %then %do %else %do</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-if-then-do-else-do/m-p/487486#M127041</link>
      <description>Reeza,&lt;BR /&gt;&lt;BR /&gt;OR option worked. The other option minoperator mindelimiter=',' generated the following errors;&lt;BR /&gt;&lt;BR /&gt;ERROR: The /MINDELIMITER= option must be a single character enclosed in single quotation marks.&lt;BR /&gt;ERROR: A dummy macro will be compiled.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 16 Aug 2018 15:49:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-if-then-do-else-do/m-p/487486#M127041</guid>
      <dc:creator>park2039</dc:creator>
      <dc:date>2018-08-16T15:49:16Z</dc:date>
    </item>
  </channel>
</rss>

