BookmarkSubscribeRSS Feed
Calcite | Level 5
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.

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.

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';

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

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

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

ods pdf text = 'between proc means steps';

proc means data=sashelp.class;
var height;
class sex;
ods pdf close;



SAS is headed back to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team.

Interested in speaking? Content from our attendees is one of the reasons that makes SAS Innovate such a special event!

Submit your idea!

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.

Get the $99 certification deal.jpg



Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 2 replies
  • 2 in conversation