<?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 Conditional Processing With Macro Vars in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Conditional-Processing-With-Macro-Vars/m-p/49570#M10283</link>
    <description>Hi All:&lt;BR /&gt;
&lt;BR /&gt;
I'm no great shakes with Macro vars and processing, so I hope someone here can help out.&lt;BR /&gt;
&lt;BR /&gt;
I have this program:&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
&lt;BR /&gt;
  %let period=Daily;      &lt;BR /&gt;
  %include source(DAILY_PROCESS);&lt;BR /&gt;
&lt;BR /&gt;
  %let period=Weekly;     &lt;BR /&gt;
  %include source(WEEKLY_PROCESS);&lt;BR /&gt;
&lt;BR /&gt;
  %let period=Monthly;    &lt;BR /&gt;
  %include source(MONTHLY_PROCESS);&lt;BR /&gt;
&lt;BR /&gt;
  %if %eval(day("&amp;amp;t_day"+1)) = 1 %then %do;&lt;BR /&gt;
&lt;BR /&gt;
      %let period=Quarterly;                                   &lt;BR /&gt;
      %include source(QUARTERLY_PROCESS); &lt;BR /&gt;
&lt;BR /&gt;
      %let period=Yearly;     &lt;BR /&gt;
      %include source(YEARLY_PROCESS);&lt;BR /&gt;
&lt;BR /&gt;
  %end;&lt;BR /&gt;
&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
But I get an error on the %if statement- I can't use it 'in open code'. (Value of &amp;amp;t_day is yesterday).  &lt;BR /&gt;
&lt;BR /&gt;
I'm sure you can see what it is that I am trying to do here.  This is the entire program - there are no DATA steps until the process code is included.&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance.</description>
    <pubDate>Wed, 13 Apr 2011 15:49:57 GMT</pubDate>
    <dc:creator>OS2Rules</dc:creator>
    <dc:date>2011-04-13T15:49:57Z</dc:date>
    <item>
      <title>Conditional Processing With Macro Vars</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditional-Processing-With-Macro-Vars/m-p/49570#M10283</link>
      <description>Hi All:&lt;BR /&gt;
&lt;BR /&gt;
I'm no great shakes with Macro vars and processing, so I hope someone here can help out.&lt;BR /&gt;
&lt;BR /&gt;
I have this program:&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
&lt;BR /&gt;
  %let period=Daily;      &lt;BR /&gt;
  %include source(DAILY_PROCESS);&lt;BR /&gt;
&lt;BR /&gt;
  %let period=Weekly;     &lt;BR /&gt;
  %include source(WEEKLY_PROCESS);&lt;BR /&gt;
&lt;BR /&gt;
  %let period=Monthly;    &lt;BR /&gt;
  %include source(MONTHLY_PROCESS);&lt;BR /&gt;
&lt;BR /&gt;
  %if %eval(day("&amp;amp;t_day"+1)) = 1 %then %do;&lt;BR /&gt;
&lt;BR /&gt;
      %let period=Quarterly;                                   &lt;BR /&gt;
      %include source(QUARTERLY_PROCESS); &lt;BR /&gt;
&lt;BR /&gt;
      %let period=Yearly;     &lt;BR /&gt;
      %include source(YEARLY_PROCESS);&lt;BR /&gt;
&lt;BR /&gt;
  %end;&lt;BR /&gt;
&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
But I get an error on the %if statement- I can't use it 'in open code'. (Value of &amp;amp;t_day is yesterday).  &lt;BR /&gt;
&lt;BR /&gt;
I'm sure you can see what it is that I am trying to do here.  This is the entire program - there are no DATA steps until the process code is included.&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance.</description>
      <pubDate>Wed, 13 Apr 2011 15:49:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditional-Processing-With-Macro-Vars/m-p/49570#M10283</guid>
      <dc:creator>OS2Rules</dc:creator>
      <dc:date>2011-04-13T15:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Processing With Macro Vars</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditional-Processing-With-Macro-Vars/m-p/49571#M10284</link>
      <description>Hi:&lt;BR /&gt;
  %IF and macro conditional logic can only be used in a SAS Macro definition -- also sometimes called a SAS Macro program. A SAS Macro definition is like this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
%macro mymacpgm(parm1=, parm2=);&lt;BR /&gt;
....some code including %IF, %DO, etc other code, datastep code, proc code, etc....&lt;BR /&gt;
%mend mymacpgm;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
                   &lt;BR /&gt;
Now, to invoke the macro definition, you must do:&lt;BR /&gt;
[pre]&lt;BR /&gt;
%mymacpgm(parm1=wombat, parm2=koala)&lt;BR /&gt;
[/pre]&lt;BR /&gt;
                      &lt;BR /&gt;
This is a very good introduction to the Macro Facility, which will take you through the basics and explain why you can't use %IF in open code:&lt;BR /&gt;
&lt;A href="http://www2.sas.com/proceedings/sugi28/056-28.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi28/056-28.pdf&lt;/A&gt;&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Wed, 13 Apr 2011 15:56:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditional-Processing-With-Macro-Vars/m-p/49571#M10284</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2011-04-13T15:56:52Z</dc:date>
    </item>
  </channel>
</rss>

