<?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: Conditional Macros using &amp;amp;sysdate in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Conditional-Macros-using-amp-sysdate/m-p/248139#M46583</link>
    <description>&lt;P&gt;I don't have a quick answer, but here are my thoughts.&amp;nbsp; I think it's likely your question is not really a macro question, it's a PROC REPORT question.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The tricky thing about the macro language is that you use it to generate SAS code, instead of typing SAS code yourself.&amp;nbsp; So when something goes wrong with a macro, you need to ask two questions:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; 1. Is my macro code generating the SAS code I want?&lt;/P&gt;
&lt;P&gt;&amp;nbsp; 2.&amp;nbsp;Is the SAS code I want correct?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When starting with macro, sometimes it helps to start by writing SAS code with no macro stuff, and get that working.&amp;nbsp; There is plenty of work to do in debugging SAS code, without worrying about tthe macro language.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It looks to me like your current version would generate the following SAS code (if run in Feburary of 2016).&amp;nbsp; &amp;nbsp; I've resolved all the macro references by hand, so apologies if I've made a mistake:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;compute emp;

   if 1 = 1 then do;
      if year = 2016 then call define("_c13_","style","style={background=gold}"); *dec;
      if year = 2016 then call define("_c2_","style","style={background=gold}"); *jan;
   end;

   else do;
      if (year=2016) then do;
         call define("_c3_","style","style={background=gold}"); *cur month;
         call define("_c2_","style","style={background=gold}"); *prev month;
      end;
   end;

 endcomp;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To my eye, that generated code looks consistent with your description of what you want.&amp;nbsp; But I would try running that code, and see if it gives you the results you want.&amp;nbsp; There is plenty of trickery involved in debugging COMPUTE blocks (it looks like data step language, but there are complexities).&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once you've got working PROC REPORT code, then try adding the macro language to make it more dynamic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope that helps.&lt;/P&gt;</description>
    <pubDate>Fri, 05 Feb 2016 02:02:17 GMT</pubDate>
    <dc:creator>Quentin</dc:creator>
    <dc:date>2016-02-05T02:02:17Z</dc:date>
    <item>
      <title>Conditional Macros using &amp;sysdate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditional-Macros-using-amp-sysdate/m-p/247993#M46542</link>
      <description>&lt;P&gt;I've been able to create a few macros to format the date like I want and to strip month and year out of &amp;amp;ysdate. For example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let refyear=%sysfunc(year("&amp;amp;sysdate"d)); results in "2016"&lt;/P&gt;
&lt;P&gt;%let fulldate= %sysfunc(date(),worddate18.); results in "February 4, 2016"&lt;/P&gt;
&lt;P&gt;%let refmofirn=%eval(%sysfunc(month("&amp;amp;sysdate"d))-1); results in "1"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My problem is that when I try to take it further using conditional statements I hit a wall. What I want to code is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the current month is January, then I want the refyear to be the current year-1, and if the current month is anythig else, I want the refyear to be the current year. So clipping some stuff online, I did the following to no avail:&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;%macro&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; refyear;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%eval&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%sysfunc&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;(month(&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;"&amp;amp;sysdate"d&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;))-&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;)= &lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%then&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%eval&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%sysfunc&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;(year(&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;"&amp;amp;sysdate"d&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;))-&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%else&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%sysfunc&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;(year(&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;"&amp;amp;sysdate"d&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;));&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; refyear;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;I'm pretty sure I'm missing something important. I've seen this with do loops that I can't understand quite yet.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;I'd like to be able to strim out a MMM from Sysdate based on the following conditions:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;if the curent month is January, then let refmofir=Dec and refmosec=Nov&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;if the current month is February, then refmofir=Jan and refmosec=Dec&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;if the current month is March, then let refmofir=Feb refmosec=Jan&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;and so on. I'm not sure if all of what I want can be done in one macro statement.&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;</description>
      <pubDate>Thu, 04 Feb 2016 15:09:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditional-Macros-using-amp-sysdate/m-p/247993#M46542</guid>
      <dc:creator>jibra</dc:creator>
      <dc:date>2016-02-04T15:09:08Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Macros using &amp;sysdate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditional-Macros-using-amp-sysdate/m-p/248004#M46547</link>
      <description>&lt;P&gt;I'm not quite following your macro.&amp;nbsp; If the goal is to have it return the previous year when it's January, and the current year in any other month, then you dont need to subtract 1 from the month.&amp;nbsp; So this works:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%macro refyear(date=);
  %if %sysfunc(month("&amp;amp;date"d))= 1 %then %eval(%sysfunc(year("&amp;amp;date"d))-1);
  %else %sysfunc(year("&amp;amp;date"d));
%mend refyear;

50   %put %refyear(date=05Jan2016);
2015
51   %put %refyear(date=01Feb2016);
2016
52   %put %refyear(date=&amp;amp;sysdate);
2016
53   %put %refyear(date=01Mar2016);
2016
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That said, you probably don't need a macro for this at all.&amp;nbsp; The&amp;nbsp; you can use the INTNX function to find the year of the previous month instead.&amp;nbsp; Like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;55   %put %sysfunc(intnx(month,"05Jan2016"d,-1), year.);
2015
56   %put %sysfunc(intnx(month,"01Feb2016"d,-1), year.);
2016
57   %put %sysfunc(intnx(month,"&amp;amp;sysdate"d,-1), year.);
2016
58   %put %sysfunc(intnx(month,"01Mar2016"d,-1), year.);
2016
&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Feb 2016 15:26:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditional-Macros-using-amp-sysdate/m-p/248004#M46547</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2016-02-04T15:26:49Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Macros using &amp;sysdate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditional-Macros-using-amp-sysdate/m-p/248006#M46548</link>
      <description>&lt;P&gt;Use a datastep. &amp;nbsp;Base SAS is for manipulating and processing data, Macro is for creating text. &amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data _null_;
  my_date=put(today(),date9.;
  call symput('WANT_DATE',my_date);
run;&lt;/PRE&gt;
&lt;P&gt;To be honest, I would keep all parameters in a dataset however, unless there is a specific reason to put to macro variable. &amp;nbsp;I mean if you want to manipulate the data, you could either get a ton of messy obfuscated macro code, or just do it in the dataset and put it out again.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2016 15:29:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditional-Macros-using-amp-sysdate/m-p/248006#M46548</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-02-04T15:29:30Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Macros using &amp;sysdate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditional-Macros-using-amp-sysdate/m-p/248037#M46560</link>
      <description>&lt;P&gt;&lt;FONT size="2"&gt;Sorry, Quentin. After rereading my post, I can see how it can be confusing. I only subtract 1 in times when the job is run in February and includes data up to January.&amp;nbsp;The reason I'm creating macros for a refyear is to call on them later in a report when I need to highlight certain cells. So my macros are:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="1"&gt;&lt;FONT color="#0000ff"&gt;%let&lt;/FONT&gt; refyear=2015; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="1"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;%let&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; refmofir=Dec; &lt;FONT color="#008000"&gt;&lt;FONT color="#008000"&gt;&lt;FONT color="#008000"&gt;*Current month (first closing);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="1"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;%let&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; refmosec=Nov; &lt;FONT color="#008000"&gt;&lt;FONT color="#008000"&gt;&lt;FONT color="#008000"&gt;*Previous month (2nd closing);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="1"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;%let&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; refmofirn=12; &lt;FONT color="#008000"&gt;&lt;FONT color="#008000"&gt;&lt;FONT color="#008000"&gt;*Current month number (first closing);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I had read about the possibility of automating even these so that any user can just open up the program and run it without having to reenter data. I call on the macros to highlight certain cells for the current and previous months by a compute statement:&lt;/P&gt;
&lt;P&gt;&lt;FONT size="1"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;compute&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; emp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="1"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt; &amp;amp;refmofirn = &lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New"&gt;&lt;FONT color="#008080" face="Courier New"&gt;&lt;FONT color="#008080" face="Courier New"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;then&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;do&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="1"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt; year = &amp;amp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New"&gt;&lt;FONT color="#008080" face="Courier New"&gt;&lt;FONT color="#008080" face="Courier New"&gt;refyear.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;-&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New"&gt;&lt;FONT color="#008080" face="Courier New"&gt;&lt;FONT color="#008080" face="Courier New"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;then&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;call&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;define&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;"_c13_"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;"style"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;"style={background=gold}"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;); &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008000" face="Courier New"&gt;&lt;FONT color="#008000" face="Courier New"&gt;&lt;FONT color="#008000" face="Courier New"&gt;*dec;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="1"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt; year = &amp;amp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New"&gt;&lt;FONT color="#008080" face="Courier New"&gt;&lt;FONT color="#008080" face="Courier New"&gt;refyear.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;then&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;call&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;define&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;"_c2_"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;"style"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;"style={background=gold}"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;); &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008000" face="Courier New"&gt;&lt;FONT color="#008000" face="Courier New"&gt;&lt;FONT color="#008000" face="Courier New"&gt;*jan;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="1"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;end&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="1"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;else&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;do&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="1"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt; (year=&amp;amp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New"&gt;&lt;FONT color="#008080" face="Courier New"&gt;&lt;FONT color="#008080" face="Courier New"&gt;refyear.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt; )&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;then&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;do&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="1"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;call&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;define&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;"_c%eval(&amp;amp;refmofirn+1)_"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;"style"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;"style={background=gold}"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;); &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008000" face="Courier New"&gt;&lt;FONT color="#008000" face="Courier New"&gt;&lt;FONT color="#008000" face="Courier New"&gt;*cur month;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="1"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;call&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;define&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;"_c%eval(&amp;amp;refmofirn)_"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;"style"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;"style={background=gold}"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;); &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008000" face="Courier New"&gt;&lt;FONT color="#008000" face="Courier New"&gt;&lt;FONT color="#008000" face="Courier New"&gt;*prev month;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="1"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;end&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="1"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;end&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="1"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;endcomp&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This way, in January, both December of refyear-1 and January of refyear are highlighted. In all other cases, the consecutive months of refyear are highlighted. See attachments. If I follow your macro, will i have to enter the put statments directly into my compute statement? I've been able to accomplish quite a bit based on the SAS community's responses as well as Tech Support's input, but I'm not sure how to integrate all I learn without major setbacks or glitches.&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12266iC801E0B424052216/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="Nov_Dec Highlights.JPG" title="Nov_Dec Highlights.JPG" /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12267i97FA00F0915A30D4/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="Dec_Jan Highlights.JPG" title="Dec_Jan Highlights.JPG" /&gt;</description>
      <pubDate>Thu, 04 Feb 2016 16:37:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditional-Macros-using-amp-sysdate/m-p/248037#M46560</guid>
      <dc:creator>jibra</dc:creator>
      <dc:date>2016-02-04T16:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Macros using &amp;sysdate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditional-Macros-using-amp-sysdate/m-p/248052#M46566</link>
      <description>&lt;P&gt;I would not use the macro, I think it will be easier without it. I think your IF statement could be like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*if year equals the year of the previous month;
if year = %sysfunc(intnx(month,"&amp;amp;sysdate"d,-1),year.) then call define("_c13_","style","style={background=gold}"); 


&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Feb 2016 18:06:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditional-Macros-using-amp-sysdate/m-p/248052#M46566</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2016-02-04T18:06:23Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Macros using &amp;sysdate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditional-Macros-using-amp-sysdate/m-p/248097#M46572</link>
      <description>&lt;P&gt;Quentin, so I'm thinking this might work, but I'm screwing up applying it somehow. This is my version:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;compute&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; emp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&amp;nbsp;&amp;nbsp; if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;%eval&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;%sysfunc&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;(month(&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New"&gt;&lt;FONT color="#008080" face="Courier New"&gt;&lt;FONT color="#008080" face="Courier New"&gt;"&amp;amp;sysdate"d&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;))-&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New"&gt;&lt;FONT color="#008080" face="Courier New"&gt;&lt;FONT color="#008080" face="Courier New"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;) = &lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New"&gt;&lt;FONT color="#008080" face="Courier New"&gt;&lt;FONT color="#008080" face="Courier New"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;then&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;do&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt; year = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;%sysfunc&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;(intnx(month,&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New"&gt;&lt;FONT color="#008080" face="Courier New"&gt;&lt;FONT color="#008080" face="Courier New"&gt;"&amp;amp;sysdate"d&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;,-&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New"&gt;&lt;FONT color="#008080" face="Courier New"&gt;&lt;FONT color="#008080" face="Courier New"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;),&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New"&gt;&lt;FONT color="#008080" face="Courier New"&gt;&lt;FONT color="#008080" face="Courier New"&gt;year.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;) &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;then&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;call&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;define&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;"_c13_"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;"style"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;"style={background=gold}"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;); &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008000" face="Courier New"&gt;&lt;FONT color="#008000" face="Courier New"&gt;&lt;FONT color="#008000" face="Courier New"&gt;*dec;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt; year = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;%sysfunc&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;(year(&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New"&gt;&lt;FONT color="#008080" face="Courier New"&gt;&lt;FONT color="#008080" face="Courier New"&gt;"&amp;amp;sysdate"d&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;)) &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;then&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;call&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;define&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;"_c2_"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;"style"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;"style={background=gold}"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;); &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008000" face="Courier New"&gt;&lt;FONT color="#008000" face="Courier New"&gt;&lt;FONT color="#008000" face="Courier New"&gt;*jan;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&amp;nbsp;&amp;nbsp; end&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&amp;nbsp;&amp;nbsp; else&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;do&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt; (year=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;%sysfunc&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;(year(&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New"&gt;&lt;FONT color="#008080" face="Courier New"&gt;&lt;FONT color="#008080" face="Courier New"&gt;"&amp;amp;sysdate"d&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;)) )&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;then&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;do&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;define&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;"_c%eval(%sysfunc(month("&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;&amp;amp;sysdate&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;"d))+1)_"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;"style"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;"style={background=gold}"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;); &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008000" face="Courier New"&gt;&lt;FONT color="#008000" face="Courier New"&gt;&lt;FONT color="#008000" face="Courier New"&gt;*cur month;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;define&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;"_c%eval(%sysfunc(month("&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;&amp;amp;sysdate&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;"d)))_"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;"style"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;&lt;FONT color="#800080" face="Courier New"&gt;"style={background=gold}"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;); &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008000" face="Courier New"&gt;&lt;FONT color="#008000" face="Courier New"&gt;&lt;FONT color="#008000" face="Courier New"&gt;*prev month;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&amp;nbsp;&amp;nbsp; end&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&amp;nbsp; end&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&amp;nbsp;endcomp&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;So I guess I'm not sure how to avoid the macro. How can I say this properly in code:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;if the (today's month - 1) is 1, then highlight gold in _c13_ of row (today's year-1) and highlight gold in _c2_ of row (today's year).&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT face="Courier New"&gt;conversely if &lt;FONT face="Courier New" size="2"&gt;(today's month - 1) ne 1, then highlight gold in _column#&amp;nbsp;equal to&amp;nbsp;today's month+1_ and highlight gold in _column# equal to today's month_.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2016 21:16:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditional-Macros-using-amp-sysdate/m-p/248097#M46572</guid>
      <dc:creator>jibra</dc:creator>
      <dc:date>2016-02-04T21:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Macros using &amp;sysdate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditional-Macros-using-amp-sysdate/m-p/248139#M46583</link>
      <description>&lt;P&gt;I don't have a quick answer, but here are my thoughts.&amp;nbsp; I think it's likely your question is not really a macro question, it's a PROC REPORT question.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The tricky thing about the macro language is that you use it to generate SAS code, instead of typing SAS code yourself.&amp;nbsp; So when something goes wrong with a macro, you need to ask two questions:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; 1. Is my macro code generating the SAS code I want?&lt;/P&gt;
&lt;P&gt;&amp;nbsp; 2.&amp;nbsp;Is the SAS code I want correct?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When starting with macro, sometimes it helps to start by writing SAS code with no macro stuff, and get that working.&amp;nbsp; There is plenty of work to do in debugging SAS code, without worrying about tthe macro language.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It looks to me like your current version would generate the following SAS code (if run in Feburary of 2016).&amp;nbsp; &amp;nbsp; I've resolved all the macro references by hand, so apologies if I've made a mistake:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;compute emp;

   if 1 = 1 then do;
      if year = 2016 then call define("_c13_","style","style={background=gold}"); *dec;
      if year = 2016 then call define("_c2_","style","style={background=gold}"); *jan;
   end;

   else do;
      if (year=2016) then do;
         call define("_c3_","style","style={background=gold}"); *cur month;
         call define("_c2_","style","style={background=gold}"); *prev month;
      end;
   end;

 endcomp;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To my eye, that generated code looks consistent with your description of what you want.&amp;nbsp; But I would try running that code, and see if it gives you the results you want.&amp;nbsp; There is plenty of trickery involved in debugging COMPUTE blocks (it looks like data step language, but there are complexities).&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once you've got working PROC REPORT code, then try adding the macro language to make it more dynamic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope that helps.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2016 02:02:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditional-Macros-using-amp-sysdate/m-p/248139#M46583</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2016-02-05T02:02:17Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Macros using &amp;sysdate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditional-Macros-using-amp-sysdate/m-p/248202#M46608</link>
      <description>&lt;P&gt;Have you condsidered setting your data up before the report procedure? &amp;nbsp;So in your data apply some flags:&lt;/P&gt;
&lt;P&gt;data report;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; set your_data;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; length flag1 flag2 $1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; if &amp;lt;logic&amp;gt; then flag1=1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; if &amp;lt;logic&amp;gt; then flag2=1;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then in your report, break on each of the flags, and use style formatting on the break groups? &amp;nbsp;Its easier to processing the data in a datastep, then use the report to just print.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2016 10:41:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditional-Macros-using-amp-sysdate/m-p/248202#M46608</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-02-05T10:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Macros using &amp;sysdate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditional-Macros-using-amp-sysdate/m-p/248274#M46619</link>
      <description>&lt;P&gt;Quentin, Thank you very much for this discussion. This is actually what the logic should be:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token keyword"&gt;compute&lt;/SPAN&gt; emp&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;

   &lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; month &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;1&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; do&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
      &lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;year&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;2015 &lt;/SPAN&gt;&lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; call &lt;SPAN class="token keyword"&gt;define&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"_c13_"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"style"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"style={background=gold}"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; &lt;SPAN class="token comment"&gt;*dec;&lt;/SPAN&gt;
      &lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;year&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;2016&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; call &lt;SPAN class="token keyword"&gt;define&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"_c2_"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"style"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"style={background=gold}"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; &lt;SPAN class="token comment"&gt;*jan;&lt;/SPAN&gt;
   end&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;

   &lt;SPAN class="token keyword"&gt;else&lt;/SPAN&gt; do&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
      &lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;year&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;2016&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; do&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
         call &lt;SPAN class="token keyword"&gt;define&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"_c3_"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"style"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"style={background=gold}"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; &lt;SPAN class="token comment"&gt;*cur month;&lt;/SPAN&gt;
         call &lt;SPAN class="token keyword"&gt;define&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"_c2_"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"style"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"style={background=gold}"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; &lt;SPAN class="token comment"&gt;*prev month;&lt;/SPAN&gt;
      end&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
   end&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
 &lt;SPAN class="token keyword"&gt;endcomp&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Like I said, my proc report runs fine if I set two macros at the beginning fo the program: %let refyear=2016; %let refmofirn=1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I use the following compute command in my proc report:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;compute emp;
	if &amp;amp;refmofirn = 1 then do;
		if year = &amp;amp;refyear.-1 then call define("_c13_","style","style={background=gold posttext='(P)'}"); *dec;
		if year = &amp;amp;refyear. then call define("_c2_","style","style={background=gold posttext='(P)'}"); *jan;
	end;
	else do;
		if (year=&amp;amp;refyear. )then do;
        	call define("_c%eval(&amp;amp;refmofirn+1)_","style","style={background=gold posttext='(P)'}"); *cur month;
        	call define("_c%eval(&amp;amp;refmofirn)_","style","style={background=gold posttext='(P)'}");  *prev month;
		end;
    end;
endcomp;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I am only trying to remove the need for my users to update the two macros each month. I thought the following logic would do it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;compute emp;
	if  %eval(%sysfunc(month("&amp;amp;sysdate"d))-1) = 1 then do;
		if year = %eval(%sysfunc(year("&amp;amp;sysdate"d)-1)) then call define("_c13_","style","style={background=gold posttext='(P)'}"); *dec;
		if year = %sysfunc(year("&amp;amp;sysdate"d)) then call define("_c2_","style","style={background=gold posttext='(P)'}"); *jan;
	end;
	else do;
		if (year=%sysfunc(year("&amp;amp;sysdate"d) ))then do;
        	call define("_c%eval(%sysfunc(month('&amp;amp;sysdate'd))+1)_","style","style={background=gold posttext='(P)'}"); *cur month;
        	call define("_c%sysfunc(month('&amp;amp;sysdate'd))_","style","style={background=gold posttext='(P)'}");  *prev month;
		end;
    end;
endcomp;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I'm getting no output with the last revision and I'm only getting&amp;nbsp;an "ERROR: Expected close parenthesis after macro function invocation not found" in the log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As far as using the data step that good&amp;nbsp;members of the community have suggested, I've never really done anythign like this in order to highlight something in a proc report. I have created data sets that I've applied in annotation tables, so I'm not exactly sure how to build that. would I merely flag something in my data set and then add a compute command with a where flag=... condition in proc report?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2016 15:36:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditional-Macros-using-amp-sysdate/m-p/248274#M46619</guid>
      <dc:creator>jibra</dc:creator>
      <dc:date>2016-02-05T15:36:03Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Macros using &amp;sysdate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditional-Macros-using-amp-sysdate/m-p/248286#M46627</link>
      <description>&lt;P&gt;As for the last paragraph, yes, that's what I was suggesting. &amp;nbsp;This is actually all proc report is doing as well, if you add out= to your proc report and see the dataset that it uses, there will be flags for certain data elements.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2016 15:53:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditional-Macros-using-amp-sysdate/m-p/248286#M46627</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-02-05T15:53:45Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Macros using &amp;sysdate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditional-Macros-using-amp-sysdate/m-p/248303#M46636</link>
      <description>&lt;P&gt;Good that you are now getting an error message.&amp;nbsp; That helps.&lt;/P&gt;
&lt;P&gt;The parenthese are wrong in:&lt;/P&gt;
&lt;PRE&gt;if year = %eval(%sysfunc(year("&amp;amp;sysdate"d)-1)) &lt;/PRE&gt;
&lt;P&gt;You want:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if year = %eval(%sysfunc(year("&amp;amp;sysdate"d))-1) &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The easiest way to test such stuff is with %PUT statements.&amp;nbsp; These simply write text to the log.&amp;nbsp; Here is my log from running the wrong version and right version:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;52   %put WRONG: %eval(%sysfunc(year("&amp;amp;sysdate"d)-1));
ERROR: Expected close parenthesis after macro function invocation not found.
WRONG: 1)
53   %put RIGHT: %eval(%sysfunc(year("&amp;amp;sysdate"d))-1);
RIGHT: 2015
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Feb 2016 16:20:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditional-Macros-using-amp-sysdate/m-p/248303#M46636</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2016-02-05T16:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Macros using &amp;sysdate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditional-Macros-using-amp-sysdate/m-p/248353#M46655</link>
      <description>Thank you Quentin that solved the issue.</description>
      <pubDate>Fri, 05 Feb 2016 17:42:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditional-Macros-using-amp-sysdate/m-p/248353#M46655</guid>
      <dc:creator>jibra</dc:creator>
      <dc:date>2016-02-05T17:42:42Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Macros using &amp;sysdate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditional-Macros-using-amp-sysdate/m-p/248355#M46656</link>
      <description>&lt;P&gt;Quentin that solves my problems. Thank you very much for your input. I can avoid putting&amp;nbsp;macros at the beginning of the program by coding the sysdate macro directly into the proc report. I used the code below and it worked quite well:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;compute variable;
	if  %eval(%sysfunc(month("&amp;amp;sysdate"d))-1)= 1 then do;
		if year = %eval(%sysfunc(year("&amp;amp;sysdate"d))-1) then call define("_c13_","style","style={background=gold posttext='(P)'}"); *dec;
		if year = %sysfunc(year("&amp;amp;sysdate"d)) then call define("_c2_","style","style={background=gold posttext='(P)'}"); *jan;
	end;
	else do;
		if (year=%sysfunc(year("&amp;amp;sysdate"d)))then do;
        	call define("_c%eval(%sysfunc(month('&amp;amp;sysdate'd))-1)_","style","style={background=gold posttext='(P)'}"); *cur month;
        	call define("_c%sysfunc(month('&amp;amp;sysdate'd))_","style","style={background=gold posttext='(P)'}");  *prev month;
		end;
    end;
endcomp;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Feb 2016 17:48:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditional-Macros-using-amp-sysdate/m-p/248355#M46656</guid>
      <dc:creator>jibra</dc:creator>
      <dc:date>2016-02-05T17:48:06Z</dc:date>
    </item>
  </channel>
</rss>

