| Date: | Tue, 25 Nov 1997 10:51:04 EST |
| Reply-To: | Richard Ristow <AP430001@BROWNVM.BROWN.EDU> |
| Sender: | "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU> |
| From: | Richard Ristow <AP430001@BROWNVM.BROWN.EDU> |
| Subject: | Conditional page breaks in the DATA step |
|
From time to time I write DATA steps (usually DATA _NULL_) that print
fairly elaborate reports to the listing file.
Often, text comes in blocks of several lines that are best kept together
on the same page -- things like a multi-line address, patient data and all
visits being listed for that patient.
I've been handling this using
FILE PRINT LINESLEFT=SPACE;
and issuing "PRINT _PAGE_;" when space is low. That works when
a.) There is a reasonably low limit on the maximum size of a text block:
start a new page when there are fewer lines than that limit
b.) The number of lines in a text block can be calculated or estimated
at the start of a block.
But sometimes there's no easy way to know the size of a block beforehand,
for example when you have to start printing at the beginning of a BY
group of unknown size.
Is there any trick for putting page breaks in printed output after the
fact? I don't think the notion is silly; if you use option N=PAGESIZE
on the FILE statement, you can change 'already printed' text on the
current page, at least.
Where it is possible to start printing a block over from the beginning, I
have toyed with the idea of monitoring the LINESLEFT variable; if it hits
zero before the block is finished, go back to the beginning line of the
block and overwrite all text with blanks; start a new page, and restart
the block. But I'd very much prefer a more elegant solution if one exists.
-Thanks,
Richard Ristow
-------------------------------------------------------------------------
If you only love people when they aren't making damn fools of themselves,
you don't really love people very much.
Richard Ristow AP430001@BROWNVM.BROWN.EDU Bitnet: AP430001@BROWNVM
Snails - Presently: Permanent:
John Carter Brown Library 25 Taber Ave.
Brown University Providence, R.I. 02906
Providence, R.I. 02912
|