BookmarkSubscribeRSS Feed
sandyming
Calcite | Level 5

I was trying to use the following code from 41461 - Put multiple PROC SGPLOT outputs on the same PDF page using PROC GREPLAY

The output page has four graphs, no space for overall titles/footnotes.

How can I put an overall title and footnote on top and bottom?

Thanks for your help,

Sandy

Change the value of the following macro   */

/* variable if you want to write the output  */

/* from the sample code to a directory other */

/* than C:\TEMP.                             */

%let outdir=c:\temp; 

options orientation=landscape nodate nonumber; 

goptions reset=all; 

/* This step uses multiple PROC SGPLOT procedures  */

/* to write multiple PNG files to disk.  Note that */

/* this step uses the IMAGENAME= option on the ODS */

/* GRAPHICS ON statement to name each PNG file     */

/* that is written to disk.                        */

ods results off;

ods listing close;

ods html path="&outdir" (url=none) file='sastest.html'

      image_dpi=300;  

ods graphics on / reset=index imagename='sgplot1'

      width=4in height=3in;

title1 'First SGPLOT Output';

proc sgplot data=sashelp.class;

   scatter x=height y=weight / group=sex;

   discretelegend;

run;

ods graphics on / imagename='sgplot2'

      width=4in height=3in;

title1 'Second SGPLOT Output';

proc sgplot data=sashelp.class;

   scatter x=height y=weight / group=sex;

   discretelegend;

run;

ods graphics on / imagename='sgplot3'

      width=4in height=3in;

title1 'Third SGPLOT Output';

proc sgplot data=sashelp.class;

   scatter x=height y=weight / group=sex;

   discretelegend;

run;

ods graphics on / imagename='sgplot4'

      width=4in height=3in;

title1 'Fourth SGPLOT Output';

proc sgplot data=sashelp.class;

   scatter x=height y=weight / group=sex;

   discretelegend;

run;

ods html close;  

ods listing;

ods results on;

/* This step uses PROC GSLIDE with the IBACK= and */

/* IMAGESTYLE= graphics options to read the PNG   */

/* files created in step 1 back into SAS.         */ 

goptions reset=all device=png300 nodisplay

         xmax=4in ymax=3in;

goptions iback="&outdir.\sgplot1.png" imagestyle=fit;

proc gslide;

run;

quit;

goptions iback="&outdir.\sgplot2.png" imagestyle=fit;

proc gslide;

run;

quit;

goptions iback="&outdir.\sgplot3.png" imagestyle=fit;

proc gslide;

run;

quit;

goptions iback="&outdir.\sgplot4.png" imagestyle=fit;

proc gslide;

run;

quit;

/* This final step uses PROC GREPLAY to put four  */

/* SGPLOT outputs on the same PDF page.           */

goptions reset=all device=sasprtc;

ods listing close;

ods pdf file="&outdir.\greplay_sgplot.pdf" notoc dpi=300;

proc greplay igout=work.gseg nofs tc=sashelp.templt

             template=L2R2;

   treplay 1:1 2:2 3:3 4:4;

run;

quit;

ods pdf close;

ods listing;

5 REPLIES 5
ballardw
Super User

YOu might look into tagsets.HTMLPanel It allows defining percent of area for each graph displayed if you have a way to convert HTML to PDF.

Or you need to make a custom template instead of using the L2R2 template. I haven't bothered with the syntax for a long time but its basically a set of coordinates as percent of display area. So make one area across the top, the four cells for the charts and and 6th area at the bottom. You'll need to create your Title and Footnote for gslide as well. You can have the areas overlap by coordinates.

There are examples in the online help under Greplay template code.

Note: Changing the aspect ration in the graph cells may distort appearance.

jimevo888
Calcite | Level 5

Below is the setup I use for my title page utilizing PROC GSLIDE... This definitely works with the PROC GREPLAY combination with PROC GCHART output. I am still exploring the options to incorporate PROC SGPLOT output into my PROC GREPLAY setup.

Good luck...

James

goptions noborder;

data   titlanno;

       length function

              color $8

              style $12

              position $1

              text $50

              html $100;

       xsys = '3';

       ysys = '3';

       hsys = '3';

       when = 'a';

/* Annotate title text at top of page */

function = 'label';

style = "&font";

y = 97.0; x = 0.5; position = '6'; color = "&browntext"; size = 2.5; text = 'Main Title 1'; output;

y = 94.5; x = 16.5; position = '6'; color = "&browntext"; size = 2.5; text = 'Main Title 2'; output;

/* y = 95.8; x = 32.0; position = '6'; color = "&graytext"; size = 1.7; text = 'SPARE SUB-TITLE SECTION 1'; output; */

/* y = 95.8; x = 90; position = '4'; color = "&graytext"; size = 1.7; text = 'SPARE SUB-TITLE SECTION 2'; output; */

goptions   xpixels = 1200

           ypixels = 800;

title;

footnote;

proc gslide   des = ""

              name = "titles"

              anno = titlanno;

run;

sandyming
Calcite | Level 5

thank you, it helps!

jimevo888
Calcite | Level 5

For full SAS/GRAPH customization, you really want to go on the ANNOTATE and PROC GREPLAY path. I have developed a fully customized 6 chart data-driven dashboard with nested VBAR in one of the charts using the annotate facility within a PROC GCHART output. The graphing output is definitely less "spectacular" in comparison to the output from PROC SGPLOT but there is still plenty of potential to create some stunning charts within a dashboard template.

Anyway good luck...

James

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 2283 views
  • 0 likes
  • 3 in conversation