The SAS Output Delivery System and reporting techniques

Limit titles to first page

Reply
Contributor
Posts: 36

Limit titles to first page

Thank you in advance..

I have a dataset that has more than 500 records and i have to produce a pdf file output
out of it using ods pdf destination in sas enterprise guide but the titles are appearing in every page which i don't want. I have titles with macro variables in it and they should appear in only first page. i tried using compute block with _page_ but by doing so i am getting line statements in all pdf pages. Is there any way to restrict titles to first page?
Thank you.
Super User
Posts: 10,046

Re: Limit titles to first page

Hi.
You can use a " proc print " before " proc report " .



Ksharp
SAS Super FREQ
Posts: 8,868

Re: Limit titles to first page

Hi:
Or, you could use two PROC REPORT steps. The bottom line, is that you have to figure out how many obs "fit" on the first page. For the default style, using SASHELP.SHOES, I can get 33 obs on the first page with 1/2 inch margins at the top and bottom of the page:
[pre]
options orientation=portrait topmargin=.5in bottommargin=.5in nodate nonumber;
title; footnote;
ods pdf file='c:\temp\onlyfirst.pdf' notoc;

proc report data=sashelp.shoes(firstobs=1 obs=33) nowd;
column region subsidiary product sales inventory returns;
title 'Title on First Page Only';
run;

title; /* clears previous title */
proc report data=sashelp.shoes(firstobs=34 obs=max) nowd;
column region subsidiary product sales inventory returns;
run;

ods _all_ close;
[/pre]

Since the TITLE statement can only be cleared between procedure steps, the second proc report picks up displaying observations with firstobs=34, but AFTER the title has been cleared with a null TITLE statement.

cynthia
Regular Contributor
Posts: 171

Re: Limit titles to first page

Posted in reply to Cynthia_sas
Of course, this solution assumes that you have no summary lines in the report. When you have summary lines in the report, splitting the dataset into two parts does not work. I have also run into this problem and I never found an acceptable alternative. See http://support.sas.com/forums/thread.jspa?messageID=40487鸧.
SAS Super FREQ
Posts: 8,868

Re: Limit titles to first page

You're right -- if you need any kind of summary information that includes what was on the first "page" then you have to do some fiddling to make it work -- but that's the difference between a word processor (that allows you to treat the first page differently from the other pages) and a report generator -- that treats the titles and footnotes as "global" statements which apply to the whole report.

You can't analyze 10 years of census data in Word, but you can get a separate title on the first page. You CAN analyze and report on 10 years of census data in SAS -- but by default all pages on the report get the same title. SAS isn't a Word processor -- SAS, using ODS, can create Word processor readable documents -- but with limits.

cynthia
N/A
Posts: 1

Re: Limit titles to first page

Posted in reply to Cynthia_sas

Just Signed up to Thank Cynthia. It has been a hell of a problem for me before I visited this forum.

Thank You again Cynthia.

Contributor
Posts: 36

Re: Limit titles to first page

Thank you guys for the suggestions. i will look into those and let you know if it is working.
Super User
Posts: 11,343

Re: Limit titles to first page

Possibly using ODS PDF Text="" before your procedure call. Add appearance options as needed/available.<BR /> <BR /> I don't use PDF much but have done this MANY times for RTF output when I have similar needs.
Contributor
Posts: 36

Re: Limit titles to first page

I used the code
Cynthia has suggested and it is working fine. Thank you very much.
Ask a Question
Discussion stats
  • 8 replies
  • 1856 views
  • 0 likes
  • 6 in conversation