Sample 24929: Generate page numbers on BY-group processed plots
/* Reset global statements */
goptions reset=all;
/* Specify macro debug options */
options mprint macrogen symbolgen;
/* Create sample data set ONE */
data one;
do bgrp='A','B','C';
do xvar=1 to 10;
yvar=ranuni(0);
output;
end;
end;
run;
/* Sort data set ONE by BGRP variable */
proc sort;
by bgrp;
run;
/* Create macro variables that resolve to page number. */
/* Create macro variables that resolve to BGRP values. */
/* Create a macro variable that resolves to total number of GPLOTs/pages. */
data _null_;
set one end=eof;
by bgrp;
if first.bgrp then count+1;
call symput('pg'||left(count),trim(left(count)));
call symput('grp'||left(count),trim(left(bgrp)));
if eof then
call symput('total',trim(left(count)));
run;
/* Create macro GPLOT. */
/* Specify a macro %do loop with subsetting WHERE statement */
/* to simulate BY-group processing and permit the macro variables */
/* to resolve. */
%macro gplot;
proc gplot data=one;
%do i=1 %to &total;
footnote1 j=r "Page &&pg&i of &total";
title2 "BGRP: &&grp&i";
plot yvar*xvar;
where bgrp="&&grp&i";
run;
%end;
quit;
%mend gplot;
/* Specify SYMBOL statement */
symbol1 v=dot i=join c=black;
/* Specify TITLE statement */
title1 h=2.5 'Specify Page Numbers';
/* Invoke macro GPLOT */
%gplot

This sample uses macro coding and a footnote statement to generate page numbers on a BY-group plot.
| Type: | Sample |
| Topic: | SAS Reference ==> Procedures ==> GPLOT Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Types ==> Plots ==> Special Plot types
|
| Date Modified: | 2005-08-31 03:03:19 |
| Date Created: | 2004-11-11 11:08:02 |
Operating System and Release Information
| SAS System | SAS/GRAPH | All | n/a | n/a |