Sample 24943: Display page numbers on replayed graphs
/* Delete entries from WORK.GSEG catalog */
proc greplay nofs igout=work.gseg;
delete _all_;
run;
data one;
input state $ num region $;
datalines;
NY 10 North
NJ 15 North
GA 10 South
AL 15 South
CA 10 West
WA 15 West
;
/* Turn DISPLAY off */
goptions nodisplay;
/* Create GSLIDE entries */
proc gslide;
title1 'test1';
run;
title1 'test2';
run;
title1 'test3';
run;
title1 'test4';
run;
quit;
/* Reset TITLE statement */
title1;
/* Create GCHART entries */
proc gchart;
vbar state/ sumvar=num patternid=midpoint;
by region;
pattern v=s;
run;
quit;
/* Create GPLOT entries */
proc gplot;
plot num*state;
by region;
symbol v=star;
run;
quit;
/* Use DSGI function NUMGRAPH to determine the number of entries in */
/* GSEG catalog. Create a macro variable that resolves to that value. */
data _null_;
rc=gset('catalog','work','gseg');
rc=ginit();
call gask('numgraph',grsegcnt,rc);
call symput('grsegcnt',grsegcnt);
rc=gterm();
run;
/* Create entries that contain page numbers */
%macro page;
%do i= 1 %to &grsegcnt;
proc gslide;
footnote1 f=swiss j=r "page -&i-";
run;
quit;
%end;
%mend page;
/* Invoke macro */
%page
/* Use GREPLAY with a two panel template, to replay the original */
/* GRSEG entry and the GRSEG entry containing the page number. */
%macro grep;
%do i=1 %to &grsegcnt;
proc greplay nofs igout=work.gseg tc=tempcat;
tdef spectwo des='two panel template'
1/ llx= 0 lly=5
ulx= 0 uly=100
urx= 100 ury=100
lrx= 100 lry=5
2/ llx=0 lly=1
ulx=0 uly=100
urx=100 ury=100
lrx=100 lry=1
color=black
;
template spectwo;
treplay 1:&i 2:%eval(&i+&grsegcnt);
run;
quit;
%end;
%mend grep;
/* Turn DISPLAY on */
goptions display;
/* Invoke macro */
%grep

This sample program dynamically add page numbers when replaying entries from a catalog. It replays the entire catalog with one graph per page.
| Type: | Sample |
| Topic: | SAS Reference ==> Procedures ==> GREPLAY
|
| Date Modified: | 2005-09-01 03:03:07 |
| Date Created: | 2004-11-11 11:08:04 |
Operating System and Release Information
| SAS System | SAS/GRAPH | All | n/a | n/a |