Quentin, Thank you very much for this discussion. This is actually what the logic should be:
compute emp;
if month = 1 then do;
if year = 2015 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;
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;
And I use the following compute command in my proc report:
compute emp;
if &refmofirn = 1 then do;
if year = &refyear.-1 then call define("_c13_","style","style={background=gold posttext='(P)'}"); *dec;
if year = &refyear. then call define("_c2_","style","style={background=gold posttext='(P)'}"); *jan;
end;
else do;
if (year=&refyear. )then do;
call define("_c%eval(&refmofirn+1)_","style","style={background=gold posttext='(P)'}"); *cur month;
call define("_c%eval(&refmofirn)_","style","style={background=gold posttext='(P)'}"); *prev month;
end;
end;
endcomp;
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:
compute emp;
if %eval(%sysfunc(month("&sysdate"d))-1) = 1 then do;
if year = %eval(%sysfunc(year("&sysdate"d)-1)) then call define("_c13_","style","style={background=gold posttext='(P)'}"); *dec;
if year = %sysfunc(year("&sysdate"d)) then call define("_c2_","style","style={background=gold posttext='(P)'}"); *jan;
end;
else do;
if (year=%sysfunc(year("&sysdate"d) ))then do;
call define("_c%eval(%sysfunc(month('&sysdate'd))+1)_","style","style={background=gold posttext='(P)'}"); *cur month;
call define("_c%sysfunc(month('&sysdate'd))_","style","style={background=gold posttext='(P)'}"); *prev month;
end;
end;
endcomp;
I'm getting no output with the last revision and I'm only getting an "ERROR: Expected close parenthesis after macro function invocation not found" in the log.
As far as using the data step that good 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?
... View more