Date: Sun, 14 Mar 2004 16:23:41 -0500
Reply-To: Don Stanley <don_stanley@PARADISE.NET.NZ>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Don Stanley <don_stanley@PARADISE.NET.NZ>
Subject: Re: Proc REPORT, how do I keep things together on a page
This is a recurring question with ODS destinations such as RTF and PDF.
Essentially you want to know about some aspect of how the non SAS entity
(Adobe, MS WORD) will format text after you write the file, esp where it
will put page throws, but you need SAS to be able to work out just what
that non SAS entity will do so you can take advantage of that knowledge.
I haven't found any reliable way to do this , except the one you do not
want to do -- run the code, look at the output, tweak the code to force new
pages (which I can do in RTF, but not sure about PDF).
I can agree with your wish to not manually tweak the code, having been
there. Don't know there is a lot SAS Inst can do about this either.
On Sun, 14 Mar 2004 12:35:27 -0500, Richard A. DeVenezia
>The sample code generates a report showing questions and answers and counts
>I use a compute before block to display the question by way of a stylized
>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
>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
>in this style.
> 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));
> format level1 level2 2.;
>ods listing close;
>ods pdf file = "%sysfunc(pathname(WORK))/report.pdf";
>options nodate nonumber;
>title "A report";
>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.;
>ods pdf close;
>Richard A. DeVenezia