The SAS Output Delivery System and reporting techniques

ODS pdf startpage=No lost the following by group title

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 13
Accepted Solution

ODS pdf startpage=No lost the following by group title

I using proc report to create 10 reports for each year.

sample codes:

ods pdf file='startpage.pdf' notoc  startpage=no;

proc report data=grain_production nowindows;

by year;

   column country type kilotons;

   define country  / group width=14 format=$cntry.;

   define type     / group 'Type of Grain';

   define kilotons / format=comma12.;

   title 'Leading Grain-Producing Countries';

   title2 'for #byval(year)';run;

when i use the startpage=no, all the results go to same page like i expected, but the title only showed at the top  of each page, not for each tables. anyway to make the title for each year's table?


Accepted Solutions
Solution
‎09-08-2014 11:51 AM
Occasional Contributor
Posts: 13

Re: ODS pdf startpage=No lost the following by group title

Hi, Cynthia:

THis is really working well. Thanks very much.

View solution in original post


All Replies
SAS Super FREQ
Posts: 8,643

Re: ODS pdf startpage=No lost the following by group title

Hi:

  As far as PDF is concerned a document has 1 title at the top of the page. If you use STARTPAGE=NO, then PDF uses the first title for the first BY group at the top of the page and then STARTPAGE=NO tells SAS that the other procedures get put somewhere OTHER than the top of the page to start. Since the procedure isn't starting at the top of the page, the assumption is that you do NOT want the SAS title in the middle of the page.

  One way to work around it is to use ODS TEXT= between multiple runs of your procedure like:

ods pdf file=...

ods text= ... ; /* for by group 1 */

** proc for by group 1;

ods text=...; /* for by group 2 */

** proc for by group 2;

ods text= ... ; /*for by group 3 */

** proc for by group 3;

ods pdf close;

  Or, specifically with PROC REPORT, use the COMPUTE BEFORE to write some custom text for each BY group. You should be able to run this code. It produced the attached results.

Cynthia

proc sort data=sashelp.class out=class;

by age name;

run;

   

options nobyline nodate nonumber;

   

ods pdf file='c:\temp\simulate_by_title.pdf' startpage=no;

  

title 'Top of Page';

proc report data=class nowd;

  by age;

  column age name sex height weight;

  define age / order noprint;

  compute before _page_;

    length pgline $10;

    pgline = catx(' ',"Age =",age);

    line "Report for Students";

line pgline $10.;

  endcomp;

run;

ods pdf close;

Attachment
Solution
‎09-08-2014 11:51 AM
Occasional Contributor
Posts: 13

Re: ODS pdf startpage=No lost the following by group title

Hi, Cynthia:

THis is really working well. Thanks very much.

New Contributor KGS
New Contributor
Posts: 2

Re: ODS pdf startpage=No lost the following by group title

I have a similar problem, in that in SAS Enterprise Guide I am writing out a series of reports in macros to ODS RTF and I am losing the titles on each PROC REPORT except at teh top of the page.  I am using STARTPAGE=NO and KEEPN, but would like to have the titles of each PROC REPORT show up.  Any suggestions?  Thanks.

SAS Super FREQ
Posts: 8,643

Re: ODS pdf startpage=No lost the following by group title

Hi:
Did you try the posted code? When I change the destination from PDF to RTF, the posted code works for me. It is not a title from a SAS title statement, but it is the BY group information in a "pseudo-title". You don't have to put the BY group information where I do in the example, but you can put any text string in the COMPUTE block you want.

cynthia
New Contributor KGS
New Contributor
Posts: 2

Re: ODS pdf startpage=No lost the following by group title

No, Cynthia, I didn't try the posted code, because I'm running six macros to produce six separate reports I'm putting into one output file that the end users want on as few pages as possible; the first attempt had page breaks between each report.  Since they are separate reports (separate data sources and all), using a BY statement won't really work.

Here's an example of the code:

 

ODS RTF FILE='/data/mk/eqpmgmt/fleet_reports/B02.rtf' STARTPAGE=NO KEEPN ;

%REPORT1(B02,B02TOT,'SPECIAL');

%REPORT2(B02,B02SUP,'SPECIAL');

%REPORT3(B02,B02DEMD,'SPECIAL');

%REPORT4(B02,B02DEMF,'SPECIAL');

%REPORT5(B02,B02LOAD,'SPECIAL');

%REPORT6(B02,B02FDEM,'SPECIAL');

ODS RTF CLOSE ;

 

Each report macro is a separate PROC REPORT with its own title, but the title is only displaying on the first report on the page.

Thanks.

 

Post a Question
Discussion Stats
  • 5 replies
  • 1089 views
  • 3 likes
  • 3 in conversation