Hello all,
I am trying to loop through a macro function which produces multiple plots/tables (via proc sgplot & proc tabulate) for different variables - a different variable is plotted in each call of the macro. The very last plot within the macro is as follows:
proc tabulate data=wr.exante_shock_scenarios;
title "&Prodcat Shock Scenario Yield Rate Forecasts";
class 'date'n;
var Flat_Rate Shock_Up_100_Rate Shock_Up_200_Rate Shock_Down_100_Rate Gradual_Up_100_Rate Gradual_Up_200_Rate Gradual_Down_100_Rate;
table mean=''*( Flat_Rate="&Prodcat. Flat_Rate"
Shock_Up_100_Rate="&Prodcat. Shock_Up_100_Rate"
Shock_Up_200_Rate="&Prodcat. Shock_Up_200_Rate"
Shock_Down_100_Rate="&Prodcat. Shock_Down_100_Rate"
Gradual_Up_100_Rate="&Prodcat. Gradual_Up_100_Rate"
Gradual_Up_200_Rate="&Prodcat. Gradual_Up_200_Rate"
Gradual_Down_100_Rate="&Prodcat. Gradual_Down_100_Rate")
*(format=comma20.2),date;
where prodcat="&Prodcat" and date in ('31DEC2012'd,'31DEC2013'd,'31DEC2014'd,'31DEC2015'd);
run;
This issue is - the text in that 'title' statement gets output above every subsequent table/produced, which is very misleading because now each of my output plots has a title above - specifying that it is a plot for the previous variable - not the actual current variable being plotted.
I.E. My first two calls to the macro producing the output are as follows:
%Produce_Output(BUSMMSADV);
%Produce_Output(RETNOW);
So now for all of the output plots/tables (the macro contains 4 sgplot statements, and 2 proc tabulates), for the call with parameter 'RETNOW' will contain the text "BUSMMSADV Shock Scenario Yield Rate Forecasts" - which is incorrect, and the call with 'BUSMMSADV' as the parameter will contain that line of text, except listing the &prodcat variable that was passed in on the last time that I executed the macro.
Is there anyway that I can clear this "item title" output so that it is only present in the proc tabulate statement that it was declared within?
Please let me know if I am not explaining this well enough, I tried my best but I feel that I may be somewhat unclear.
Thanks a lot guys!!
Hi:
First rule of Titles and Footnotes: they are global. They stay in effect until changed or deleted. To delete a TITLE or FOOTNOTE,
I am something of a control freak. I put a TITLE statement for every procedure step I have. But then, I also RESET or DELETE that title statement after the RUN; I know, it seems silly to do that, because if the next procedure has a TITLE statement, that is what will be used. But if I do not RESET the TITLE statement after my -last- procedure, then that TITLE statement will hang around and impact subsequent steps.
So, here's my model. No matter what. All the time, every time. What is within the procedure step belongs to the procedure step. After the procedure, I clear the title and footnote used for the procedure. All the time.
cynthia
proc whatever data=mydata;
title 'Whatever';
footnote 'Whatever Else';
something;
something;
something else;
run;
title;
footnote;
proc wombat data=moredata;
title 'Whatever Again';
footnote; /* no footnote for this step */
something;
something;
run;
title;
footnote;
Hi:
First rule of Titles and Footnotes: they are global. They stay in effect until changed or deleted. To delete a TITLE or FOOTNOTE,
I am something of a control freak. I put a TITLE statement for every procedure step I have. But then, I also RESET or DELETE that title statement after the RUN; I know, it seems silly to do that, because if the next procedure has a TITLE statement, that is what will be used. But if I do not RESET the TITLE statement after my -last- procedure, then that TITLE statement will hang around and impact subsequent steps.
So, here's my model. No matter what. All the time, every time. What is within the procedure step belongs to the procedure step. After the procedure, I clear the title and footnote used for the procedure. All the time.
cynthia
proc whatever data=mydata;
title 'Whatever';
footnote 'Whatever Else';
something;
something;
something else;
run;
title;
footnote;
proc wombat data=moredata;
title 'Whatever Again';
footnote; /* no footnote for this step */
something;
something;
run;
title;
footnote;
Ahhh I see. I was trying different ODS options, I didn't think it would be as simple as just "title;" Thank you very much Cynthia!!
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: