Hi Cynthia,
I have the same problem with mgm. I used the same code in example 24939 with a few modifications to fit my data and currently I have 6 graphs in one page. My problem is that I have 304 graphs created using gplot and the "by variety" statement. I wish to distribute these graphs into 6 graphs for the 51 pages we're planning to print instead of just having the first 6 graphs printed into one page. I don't know which part of the program to modify:
goptions reset=all;
options mprint macrogen symbolgen;
goptions dev=ps hby=0;
%let across=3;
%let down=2;
%let npanels=%eval(&down*&across);
goptions reset=goptions device=png target=png;
proc greplay nofs igout=work.gseg;
delete _all_;
run;
quit;
data garea;
rc=ginit(); /* Initialize DSGI */
call gask('hsize',hsize,rc); /* Get default HSIZE for driver */
hsze=hsize/&across; /* Calculate horiz panel size */
call symput('hsize',left(trim(hsze))); /* Create HSIZE macro var */
call gask('vsize',vsize,rc); /* Get default VSIZE for driver */
vsze=vsize/&down; /* Calculate vert panel size */
call symput('vsize',left(trim(vsze))); /* Create VSIZE macro var */
rc=gterm(); /* Terminate DSGI */
run;
goptions nodisplay hsize=8.3333 vsize=6.25;
proc sort data=Annotated;
by Variety Watering SumT;
run;
symbol1 r=2 i=join v=none;
proc gplot data=Annotated uniform;
plot predit_aero*SumT predit_flood*SumT/annotate=Annotated overlay legend=legend1;
by Variety;
run;
quit;
data numgraf;
rc=gset('catalog','work','gseg'); /* Open the WORK.GSEG catalog*/
rc=ginit();
call gask('numgraph',grsegcnt,rc); /* Get number of graphs in catalog*/
if grsegcnt<&npanels then num=grsegcnt; /* If there are more graphs than */
else num=304; /* panels, replay only as many graphs as there are panels.*/
call symput('numgrph',left(trim(num))); /* Number of graphs to replay */
ymult=100/&down; /* Calculate Y increment for panels */
xmult=100/&across; /* Calculate X increment for panels */
rc=gterm(); /* Terminate DSGI */
run;
data coord;
set numgraf;
do x=0 to (100-xmult) by xmult; /* Calculate the X coordinate values */
llx=x;
ulx=x;
urx=x+xmult;
lrx=x+xmult;
do y=0 to (100-ymult) by ymult; /* Calculate the Y coordinate values */
lly=y;
uly=y+ymult;
ury=y+ymult;
lry=y;
output;
end;
end;
run;
proc sort data=coord;
by descending y;
run;
data mccoord;
set coord end=eof;
call symput('llx'||left(_n_),llx);
call symput('ulx'||left(_n_),ulx);
call symput('urx'||left(_n_),urx);
call symput('lrx'||left(_n_),lrx);
call symput('lly'||left(_n_),lly);
call symput('uly'||left(_n_),uly);
call symput('ury'||left(_n_),ury);
call symput('lry'||left(_n_),lry);
if eof then call symput('total',_n_);
run;
%macro tempdef;
%do i=1 %to &total;
&i / llx=&&llx&i lly=&&lly&i
ulx=&&ulx&i uly=&&uly&i
urx=&&urx&i ury=&&ury&i
lrx=&&lrx&i lry=&&lry&i
%end;
%mend tempdef;
%macro tplay;
%do i=1 %to &numgrph;
&i:&i
%end;
%mend tplay;
goptions reset=goptions target=ps;
proc greplay nofs igout=work.gseg tc=work.templt;
tdef spec&npanels
%tempdef; /* Invoke macro TEMPDEF to create template */
template spec&npanels;
treplay
%tplay; /* Invoke macro TPLAY to replay graphs */
run;
quit;
Hi,
I am using PROC SGPLOT to create graph. How can i create graph catalog in work library with sgplot procedure so I can use that in proc greplay procedure. like other procedure have gout = option.
HI mgm can you please share how you solved this problem as i am running into the same proble and cant seem to get what i am trying to do, i Have more than 100 graphs and i want 10 graphs per page , i am also using the by statement in Gplot , can you please help me with this.
Thanks
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.
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.