Hi:
Along the lines of 6 different ways to do things, here's a DATA step and PROC REPORT that does a bit more work in PROC REPORT and does NOT use the LINE statement and does NOT use the technique outlined in the paper.
For something completely different...
cynthia
[pre]
data temp;
length region county $15;
input region $ county $ ;
datalines;
1 100
1 200
1 200
2 300
2 300
;
run;
proc sort data=temp out=temp;
by region county;
run;
data pp_temp;
set temp;
by region county;
retain pg 0;
if first.county then pg + 1;
** as long as we are in a data step, make some display versions of region and county;
p_reg = region;
p_cnt = county;
run;
ods listing;
proc print data=pp_temp;
title 'What does pre-processed data look like??';
var region pg county p_reg p_cnt;
run;
ods listing close;
ods pdf file='c:\temp\output\alt_method.pdf';
proc report data=pp_temp nowd;
title 'Final Report';
column region pg county p_reg p_cnt n;
define pg / order noprint;
define region / order noprint;
define county / order noprint;
define p_reg / display 'Region'
style(column)={just=r};
define p_cnt / display 'County'
style(column)={just=r};
define n / 'count' noprint;
break before pg / page;
break after region / summarize;
break after pg / summarize;
rbreak after / summarize;
** Now put the count and the labels for the summary lines;
** into P_REG and P_CNT columns;
compute after pg;
p_reg = 'County Total:';
p_cnt = put(n,3.0);
endcomp;
compute after region;
p_reg = 'Region Total:';
p_cnt = put(n,3.0);
endcomp;
compute after;
p_reg = 'Grand Total:';
p_cnt = put(n,3.0);
endcomp;
run;
ods pdf close;
[/pre]
... View more