BookmarkSubscribeRSS Feed
phil27
Calcite | Level 5
Hi,
I perform Proc Freq outputs in a pdf file.

I use the Startpage=No option for performing many reports within the same page.

I use the code :
ods pdf text="^S={LayoutOfTheText}MyTitle";

to insert text as a title inside the pages, above the reports.
It works well but a break page can occur between the text and its report if the report is too long.

I don't know the number of line of each report.

Is there a way of preventing the page breaks between the text and the report ?
Or is there another way of printting a title above each report ? I don't use the title option because the same title would be given for many reports in the same page.

Thanks.
2 REPLIES 2
Cynthia_sas
SAS Super FREQ
Hi:
I'm not sure this is really a SAS/GRAPH question. You may be able to selectively use STARTPAGE=NOW to force a page break -always- before a certain procedure's output -- but, it's not necessarily going to work the way I think you want. It sounds to me like you want to have a variable page break if the text and report is getting close to the bottom of the page and that's a little harder to do.

Vertical page breaking attaches to the "procedure" not to the number of lines in the pagesize (PAGESIZE and LINESIZE options, for example are ignored for ODS destinations, because they are irrelevant to a proportional spaced font.). STARTPAGE=NO is suppressing the default behavior that SAS has of inserting a "page feed" or "page break" BEFORE each procedure.

STARTPAGE=YES resumes normal page breaking behavior, after you've turned it off. STARTPAGE=NOW allows you to insert a page break between procedure steps so that a certain procedure will always get a page break before it. By using the TITLE statement selectively, you can make sure that the title (or the ODS TEXT= string appears where you want.

When I run the code below, both PROC MEANS steps are on page 2 and the title for the first PROC MEANS does appear at the top of the second page.

cynthia
[pre]
ods pdf file='pg.pdf' startpage=no;

ods pdf text='before proc print';
proc print data=sashelp.class(obs=5);
title 'Title for Proc Print';
run;

ods pdf text='between proc print and proc freq';
proc freq data=sashelp.class;
tables age;
run;
title;

** now, insert a page break, so the 2 proc means are together;
ods pdf startpage=now;
run;
title 'proc means title on page 2';

ods pdf text='before first proc means';
proc means data=sashelp.class;
var weight;
class sex;
run;

ods pdf text = 'between proc means steps';

proc means data=sashelp.class;
var height;
class sex;
run;
title;
ods pdf close;
[/pre]

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 2154 views
  • 0 likes
  • 2 in conversation