My code that doesn't work is placing page headers and footers (company, page, program, date) inside the plot instead of on page top and bottom margin spaces. How can I fix it? Thank you in advance!
My code:
** Page Headers and Footers;
title1 j=left font='Arial' 'Company' j=right "Page ~{pageof}";
title2 j=left font='Arial' 'Protocol';
footnote1 j=left font='Arial' 'Program: myprogram.sas' j=right "Date Produced: date";
footnote2 j=right font='Arial' "Date of Data Cut: date";
*** Box and Whisker plot ***;
options formchar="|____|+|___+=|_/\<>*" pageno=1 nonumber nodate orientation=landscape center;
ods listing close;
ods rtf file="&path.\myplot.rtf" style=journal ;
ods escapechar='~';
ods listing image_dpi=200;
%let margin=%sysfunc(cats(%eval((100-30)/2),%));
ods rtf text="~S={leftmargin=&margin. rightmargin=&margin. just=center font=('Arial',9.5pt,bold italic)} Figure 1. Distribution of TBR";
proc sgplot data=lsn_plt noborder;
vbox lsn_avg / category=dose;
yaxis label="TBR" grid;
xaxis label="Dose (mg)";
run;
%let margin=%sysfunc(cats(%eval((100-60)/2),%));
ods rtf text="~S={leftmargin=&margin. rightmargin=&margin. just=l font=('Arial', 9pt)}Notes:
~n Tukey box and whisker plot.";
ods rtf close;
ods listing;
The output is in the attached file
Specify NOGTITLE and NOGFOOTNOTE on the ODS RTF statement, and see if that gives you what you want.
Hope this helps!
Dan
Hello,
I don't see a straightforward option for this within the ODS GRAPHICS statement or the SGPLOT procedure statement, but I have an idea. The procedures like SGPLOT and SGPANEL automatically pull in the title and footnotes, but SGRENDER doesn't. You could output your SGPLOT code to use GTL instead and use SGRENDER to make your plot. This should leave your titles/footnotes in your document. You can use the TMPLOUT option within the SGPLOT statement to have it create the GTL code for you (you'd have to manually copy and paste the code from the output program back into your original program). You might have to remove ENTRYTITLE and ENTRYFOOTNOTE statements if you have active titles/footnotes when you run SGPLOT.
TMPLOUT=“filename”
writes the Graph Template Language code for your graph to a file. Writing your template code to a file can be useful for building larger Graph Template Language definitions.
Restriction | Graphs that contain summarized data (for example, bar, line, and dot) do not generate a useable template. For summarized data, the procedure sets internal values for one or more variables, and these internal values do not exist in the data set that is used with the procedure. |
Thanks for your reply, Jeff. I didn't catch all of that, but it reminds me, I don't think there is a need for the options listed in the reply below when rendering a plot template.
Helena
Specify NOGTITLE and NOGFOOTNOTE on the ODS RTF statement, and see if that gives you what you want.
Hope this helps!
Dan
Thanks for your reply, Dan. It worked!
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.