Data visualization with SAS programming

How to create multiple graphs on mutiple pages (creating graphs through Gplot using by statement)

Reply
Contributor
Posts: 43

How to create multiple graphs on mutiple pages (creating graphs through Gplot using by statement)

HI i am creating graphs using GPLOT , (specifically ploting prices against time) using by statement (Stock name), i get more than 100 graphs and i want to have 10 graphs per page as an output, NEED HELP URGENTLY

Respected Advisor
Posts: 4,606

Re: How to create multiple graphs on mutiple pages (creating graphs through Gplot using by statement)

You can use GREPLAY to 1) define the page layout for 10 graphs and 2) associate each set of 10 graphs, in turn, to your template. - PG

PG
Contributor
Posts: 43

Re: How to create multiple graphs on mutiple pages (creating graphs through Gplot using by statement)

I al having problems defining the layout can you please guide me how to , because such a template doesnot exist in built in templates , and further more if i use builtin templates it gives me a singe page and not multiple pages

Respected Advisor
Posts: 4,606

Re: How to create multiple graphs on mutiple pages (creating graphs through Gplot using by statement)

I haven't used GREPLAY in ages. Basically, I never had the patience to get the result that I wanted. I much prefer SGPANEL for this kind of graph layout. Consider :

data test;
call streaminit(87575);
value = 100;
do stock = 1 to 100;
     do time = 1 to 20;
          value + rand("NORMAL",0,5);
          output;
          end;
     end;
run;

proc sgpanel data=test;
panelby stock / layout=panel rows=5 columns=2;
series x=time y=value;
run;

hth

PG

PG
SAS Employee
Posts: 963

Re: How to create multiple graphs on mutiple pages (creating graphs through Gplot using by statement)

When you say you want "10 graphs per page as an output", what form do you want this output to be in? ...

A web page, printed page, physical computer screen, pdf document pages, html pages, 10 graphs per png image, other?

Contributor
Posts: 43

Re: How to create multiple graphs on mutiple pages (creating graphs through Gplot using by statement)

PDF document would be fine,

Valued Guide
Posts: 723

Re: How to create multiple graphs on mutiple pages (creating graphs through Gplot using by statement)

hi ... the attached SAS code produced the attached PDF file (I'm sure Robert will also have ideas) .. the PNG file is just a screen capture of the PDF output

given that you'll accept PDF output, it's easy to place output from SAS/Graph PROCs at various locations on a page using GOPTIONS (vorigin and horigin)

you can also specify the size of the output from SAS/Graph PROCs with GOPTIONS (hsize and vsize)

if you look at any of the maps on this page ... http://www.health.ny.gov/statistics/chac/chds.htm ... the horizontal bar chart and map were placed on the same page using the method shown in the attached SAS code (just scroll down and click on any map link)

Attachment
Attachment
Contributor
Posts: 43

Re: How to create multiple graphs on mutiple pages (creating graphs through Gplot using by statement)

cant see any attached code, new to this forum so dont really know how it works

Valued Guide
Posts: 723

Re: How to create multiple graphs on mutiple pages (creating graphs through Gplot using by statement)

hi ... the SAS code is in the TEN_THINGS_SAS.ZIP that's attcahed (along with the PDF and PNG files) to my posting

just in case that's still a problem ...

proc sort data=sashelp.class out=class;

by height;

run;

ods results off;

ods listing close;

* use startpage=never to keep adding to a single page;

ods pdf file='z:\ten_things.pdf' notoc startpage=never;

options orientation=landscape;

* title for all ten "plots";

goptions reset=all border ftext='calibri' htext=2.5;

proc gslide;

title 'TEN "DIFFERENT" THINGS FROM SAS/GRAPH GPLOT AND GSLIDE ON ONE PAGE' ls=2;

run;

quit;

* resize graphics output to 2x3 inches;

goptions reset=all border ftext='calibri' gunit=pct htext=3 hsize=2in vsize=3in;

symbol1 v=dot i=join h=2 c=blue;

axis1 label=(a=90);


* use horigin and vorigin to place output on the page;

* 5 charts from GPLOT;

proc gplot data=class;

title 'PLOT #1' ls=2;

goptions horigin=0.4in vorigin=1.0in;

plot weight*height / vaxis=axis1;

run;

title 'PLOT #2' ls=2;

goptions horigin=2.45in;

plot weight*height / vaxis=axis1;

run;

title 'PLOT #3' ls=2;

goptions horigin=4.5in;

plot weight*height / vaxis=axis1;

run;

title 'PLOT #4' ls=2;

goptions horigin=6.6in;

plot weight*height / vaxis=axis1;

run;

title 'PLOT #5' ls=2;

goptions horigin=8.65in;

plot weight*height / vaxis=axis1;

run;

quit;


* 5 charts from GLSIDE;

proc gslide;

title 'GSLIDE #1' ls=2;

goptions horigin=0.4in vorigin=4.25in;

run;

title 'GSLIDE #2' ls=2;

goptions horigin=2.45in;

run;

title 'GSLIDE #3' ls=2;

goptions horigin=4.5in;

run;

title 'GSLIDE #4' ls=2;

goptions horigin=6.6in;

run;

title 'GSLIDE #5' ls=2;

goptions horigin=8.65in;

run;

quit;


ods pdf close;

ods listing;

ods results;

Post a Question
Discussion Stats
  • 8 replies
  • 607 views
  • 1 like
  • 4 in conversation