Data visualization with SAS programming

How do I print page headers and footers in an RTF file when using PROC SGPLOT

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 15
Accepted Solution

How do I print page headers and footers in an RTF file when using PROC SGPLOT

[ Edited ]

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

 


Accepted Solutions
Solution
‎04-20-2018 10:34 AM
SAS Super FREQ
Posts: 1,047

Re: How do I print page headers and footers in an RTF file when using PROC SGPLOT

Posted in reply to numbergirl

Specify NOGTITLE and NOGFOOTNOTE on the ODS RTF statement, and see if that gives you what you want.

 

Hope this helps!

Dan

View solution in original post


All Replies
Occasional Contributor
Posts: 7

Re: How do I print page headers and footers in an RTF file when using PROC SGPLOT

Posted in reply to numbergirl

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.

RestrictionGraphs 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.
Occasional Contributor
Posts: 15

Re: How do I print page headers and footers in an RTF file when using PROC SGPLOT

Posted in reply to JeffMeyers

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

Solution
‎04-20-2018 10:34 AM
SAS Super FREQ
Posts: 1,047

Re: How do I print page headers and footers in an RTF file when using PROC SGPLOT

Posted in reply to numbergirl

Specify NOGTITLE and NOGFOOTNOTE on the ODS RTF statement, and see if that gives you what you want.

 

Hope this helps!

Dan

Occasional Contributor
Posts: 15

Re: How do I print page headers and footers in an RTF file when using PROC SGPLOT

Thanks for your reply, Dan.   It worked!

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 115 views
  • 2 likes
  • 3 in conversation