Date: Sun, 14 Mar 2004 12:35:27 -0500
Reply-To: "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Subject: Proc REPORT, how do I keep things together on a page
The sample code generates a report showing questions and answers and counts
thereof.
I use a compute before block to display the question by way of a stylized
line statement.
The answers come after the questions in the report. Some answers are very
long and take up more than one line in the report. No question has more
answers than would fit on a page (this is good)
At the bottom of page 1 there is only enough room left to show 3 answers of
question 6, which has 18 answers.
Thus, I would like to force a page feed and show the question and answers on
the next page.
Any ideas how to make this happen ?
I don't want to have to tweak the code or data for every data being reported
in this style.
Richard
* =====;
data info;
length question $30 answer $600;
do level1 = 1 to 20;
nlevel2 = int (1 + 20*ranuni(2));
question = 'Question ' || put(level1,2.) || ' has ' || put(nlevel2,2.)
|| ' answers';
do level2 = 1 to nlevel2;
answer = 'Answer ' || put(level2,2.) || ' responses';
if level2 = 2 then
answer = ' I hope this makes sense ' || answer;
if level2 = 5 then
answer = 'Some answers will have very long narrative text.'
|| ' Not always on answer 5, because as you should'
|| ' know, the answers under each question will be'
|| ' different. I hope this makes sense. '
|| answer;
n = int (100*ranuni(1));
output;
end;
end;
format level1 level2 2.;
run;
ods listing close;
ods pdf file = "%sysfunc(pathname(WORK))/report.pdf";
options nodate nonumber;
title "A report";
footnote "Attributation";
proc report nowindows data=info center style(header)=[background=white];
columns question answer n;
define question / order noprint;
define answer / order display style = [ just=right ];
define n / display style = [just=center];
compute before question
/ style =
[ background = cxDDDDDD
just = left
]
;
line question $200.;
endcomp;
run;
ods pdf close;
* =====;
--
Richard A. DeVenezia