Data visualization with SAS programming

Replaying a group of graphs to a gridded layout

Accepted Solution Solved
Reply
Regular Contributor
Posts: 179
Accepted Solution

Replaying a group of graphs to a gridded layout

Hi,

 

I stored a series of gmap outputs to a document store and am trying to replay them to one or more sheets in a PDF file.  Each image should fit in a 2.75x3.5" rectangle and I wanted them 3 across (in landscape mode).

 

The code I'm using is:

 

options mprint nodate nonumber center orientation=landscape;
options topmargin=.25IN bottommargin=.25IN leftmargin=.25IN rightmargin=.25IN ;
ods graphics on / width=3.5in height=2.75in;
ods pdf notoc file="&path.test.pdf";

ods layout gridded columns=3 advance=table;
ods region width=3.5in height=2.6in;
proc document name=in.ActV;
replay \zipmap / levels=all;
run;
quit;

ods layout end;
ods pdf close;

 

Directing this to HTML, I get what I would expect: 3 columns and however many rows the data populates.  Going to PDF, the 1st column disappears and only 1 or two graphs show up per page.  The image that does show up is the 2nd column shifted to the 3rd column's position.

 

I'm not sure what's going on, or how to tell Proc document to drop an image in each of the row/column positions.  None of the arguments in the advance= ODS option seems to fit.  I attached the sample pdf file to illustrate the issue.

 

?

 

Thanks!

 

--Ben


Accepted Solutions
Solution
‎03-08-2017 08:14 AM
SAS Super FREQ
Posts: 703

Re: Replaying a group of graphs to a gridded layout

Ben

 

This all seems to be related to the device being used, using GOPTIONS DEVICE=PNG, it seems to work alright. Using ACTXIMG or JAVAIMG then things look differently. I do not have an explanation for this.

 

Bruno

View solution in original post


All Replies
SAS Super FREQ
Posts: 703

Re: Replaying a group of graphs to a gridded layout

Ben

 

I suggest you adjust the size of the graphs as you are creating them, so that they later will fit on the page as you need it.

 

Here is a sample program that can be used to test it out. You can adjust the VSIZE and HSIZE options to see what happens.

 

I have used centimeters and did go with the default margins.

 

 


proc catalog c=work.gseg kill;
run;
quit;

/*proc document name=work.docs;*/
/*  delete \GChart#1  / levels=all;*/
/*run;*/

proc sort
  data=sashelp.cars
  out=cars
;
  by type;
run;


options ;

goptions
  reset=all
  device=png
  vsize=7cm
  hsize=8cm
  border
;

ods document name=work.docs(write);
proc gchart data=cars;
  by type;
  vbar drivetrain / subgroup=Origin;
run;
quit;
ods document close;


options
  orientation=landscape
  papersize="iso a4"
;
/*ods html file="c:\temp\report.html";*/

/*proc document name=work.docs(read);*/
/*   list / levels=all bygroups;  */
/*run;*/

ods pdf file="c:\temp\report.pdf" gtitle;

ods layout gridded columns=3 advance=output ;
proc document name=work.docs;
replay \GChart#1 / levels=all;
run;
quit;
ods layout end;
/*ods html close;*/
ods pdf close;

Bruno

Regular Contributor
Posts: 179

Re: Replaying a group of graphs to a gridded layout

Hi Bruno,

 

Thanks for replying.  I suspect it is size related but am not sure it is the root cause in this instance.  Consider the following test where I used the state map dataset and pulled off the first 15 outlines.  I reduced the size of the images to a 2"x2" square and the pdf actually got worse.  ?  I suspect the layout code is working because when I uncomment the ods html statement that comes out fine.

 

--Ben

 

title;
options nodate topmargin=.1in bottommargin=.1in leftmargin=.1in rightmargin=.1in orientation=landscape;

ods graphics on / width=2in height=2in;
goptions device=actximg hsize=2in vsize=2in;;
ods html close;

* select an empty pattern (v=e);
pattern v=e;

proc sql outobs=15;
create table states as select distinct statecode from maps.us;
run;

proc sort data=maps.us out=maps; by statecode; run;

proc document name=work.states;
delete \states;
run;
quit;

ods document name=work.states (update) dir=(path=\states label='States');

proc gmap map=maps data=states;
by statecode;
id statecode;
choro statecode / nolegend;
run;

quit;
ods document close;


ods pdf notoc file="&path.test.pdf";
*ods html;
ods layout gridded columns=3 advance=output column_gutter=0;
ods region;

proc document name=states ;
replay \states /levels=all;
run;
quit;
ods layout end;

ods pdf close;

 

Solution
‎03-08-2017 08:14 AM
SAS Super FREQ
Posts: 703

Re: Replaying a group of graphs to a gridded layout

Ben

 

This all seems to be related to the device being used, using GOPTIONS DEVICE=PNG, it seems to work alright. Using ACTXIMG or JAVAIMG then things look differently. I do not have an explanation for this.

 

Bruno

Regular Contributor
Posts: 179

Re: Replaying a group of graphs to a gridded layout

Hi Bruno

Thanks! So it wasn't an issue with sizing after all. I was leading myself down the wrong path. Sounds like I need to run this by the folks in tech support in case there is something that needs to be fixed.

Much appreciated!

Ben
☑ This topic is solved.

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

Discussion stats
  • 4 replies
  • 160 views
  • 0 likes
  • 2 in conversation