BookmarkSubscribeRSS Feed
Leo9
Quartz | Level 8

I am trying to create four individual plots using proc sgrender and proc template. The four plots are coming up fine in the pdf format but SAS is not generating png file with all four plots in one file. Please see the code below. Any suggestions ? 

 


ods listing close;
ods listing  gpath="../output/stat/fig" image_dpi=&dpi ;

ods graphics / height=5in width=10in outputfmt=png imagename="&test";

options orientation=landscape;
ods _all_ close;
ods pdf notoc
dpi=&dpi
file="&output"
style=mystyles startpage=no;

ods layout Start width=10in height=5in columns=2 rows=2 column_gutter=.05in row_gutter=.08in row_heights=(2.2in 2.2in);

xxxx

 

 

ods layout end;
ods pdf close;

 

3 REPLIES 3
ballardw
Super User

I suspect that what you will have to do is create a single template that plots all four as a single plot if you want a single png file.

But that will not display in different regions of your PDF file.

 

The GTL datalattice may allow creating the file. If you want a single PNG and use of PDF layout regions you may need to make two passes: on for the PDF and use of a second template with a different ODS destination to save the single PNG.

 

 

Leo9
Quartz | Level 8

Thanks for the input. Could you please elaborate more I didn't quite understand what you were trying to say.

 

ballardw
Super User

@Leo9 wrote:

Thanks for the input. Could you please elaborate more I didn't quite understand what you were trying to say.

 


You are currently calling Proc SGRENDER 4 times. That will create 4 image files. You are using PDF layout regions to place them into a 2 row 2 column display.

 

To get a single image with that appearance then you would need to do something to combine the 4 GTL templates you are calling into a single template and use a single call to proc sgrender without the PDF layout row and column code.

 

ods layout Start width=10in height=5in columns=2 rows=2 column_gutter=.05in row_gutter=.08in row_heights=(2.2in 2.2in);

The above line has 2 columns and 2 rows. Those pieces would have to be removed along with the gutter values (address that in the modified template code)

 

ods region row=1 column=1;

Says which region of the PDF the sgrender output goes to. All of those region statements would go away.

 

You would have a single call to proc sgender.

 

The code for the 4 templates plotscat1-plotscat4 would have to be combined somehow. Since you are using 4 data sets, those would have to be combined to work with the template.

 

Without the data and the templates that is as far as I am willing to suggest at this time.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

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
  • 3 replies
  • 1690 views
  • 3 likes
  • 2 in conversation