Sample 24700: Determining page breaks using LINESLEFT=
Use the LINESLEFT= option on the FILE statement to determine where a page break occurs based on the number of lines left on a page. The number of lines per page is set by PAGESIZE= option. Create a page count and write it out at the bottom of
each page. Use the END= option to determine when the last
observation is processed in order to write out the final page
count.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
/**************************************************************************/
/* The INFO data set contains 20 values. The DATA _NULL_ step writes ten */
/* observations per page plus the page number. */
/**************************************************************************/
data info;
do value=1 to 20;
output;
end;
run;
data _null_;
set info end=end;
/* Using PRINT as a fileref routes output to the OUTPUT window. If */
/* you specify another fileref or path, add the PRINT option to the */
/* FILE statement. */
file print notitles linesleft=lines pagesize=20 ;
put @1 value 2.;
/* If fewer than 11 lines remain on the page and the current observation */
/* is not the last observation in the data set, force a new page. */
if lines < 11 and not end then
do;
/* Increment the page number */
page+1;
/* Write out page number*/
put / @5 "Page " page;
/* Force a page break */
put _page_;
end;
if end then
do;
page+1;
put / @5 "Page " page;
end;
run;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
1
2
3
4
5
6
7
8
9
10
Page 1
...
11
12
13
14
15
16
17
18
19
20
Page 2
Use the LINESLEFT= option on the FILE statement to determine where a page break occurs based on the number of lines left on a page. The number of lines per page is set by PAGESIZE= option.
Type: | Sample |
Topic: | SAS Reference ==> DATA Step Query and Reporting ==> Creating Reports ==> Non Graphical
|
Date Modified: | 2019-06-10 09:12:44 |
Date Created: | 2004-09-30 14:09:05 |
Operating System and Release Information
SAS System | Base SAS | All | n/a | n/a |