The SAS Output Delivery System and reporting techniques

PDF, contents and creating a front page

Reply
N/A
Posts: 0

PDF, contents and creating a front page

Hi,
I face a few challenges with ods pdf:

I have created a nice .pdf report, and added a table of contents by means of the CONTENTS option for ods pdf. This was quite easy and by using ods proclabel statements I even got some meaningful text in the table of contents...

First question:
How to insert a front page, prior to the table of contents in my document?

On that front page (and optionally on the following pages) I would like to insert a picture in the lower right corner of the pages, how to do that?

Last question (for now...) My report consist of output from several proc's, is there an easy way to ensure that all tables share the same width? I have tried UNIFORM but can't really make it work...

Thank you in advance
BR
Jenny
SAS Super FREQ
Posts: 8,739

Re: PDF, contents and creating a front page

Jenny:
You CAN make all your procs use the same output width. There is a style attribute called OUTPUTWIDTH that you can use to tell ODS how WIDE to make the tables. So, for example:[pre]

ods pdf file='c:\temp\allwide.pdf';
proc print data=sashelp.class
style(table)={outputwidth=100%};
var name age height;
run;

proc print data=sashelp.shoes(obs=5)
style(table)={outputwidth=100%};
var region product sales;
run;
ods pdf close;[/pre]

BUT if your procedures of choice are something other then PRINT, REPORT or TABULATE, then you either have to alter the TABLE template for the procedure to specify the OUTPUTWIDTH attribute (not a great choice) OR alter the STYLE template that you're using to specify the OUTPUTWIDTH attribute as a style for all output (better choice).

For an example of changing the OUTPUTWIDTH attribute, refer to this Tech Support Note (it is for HTML, but with a few modifications, should work for PDF):
http://support.sas.com/faq/040/FAQ04032.html

Tech Support can help you with the PROC TEMPLATE modifications you would need to alter this example for PDF. http://support.sas.com/techsup/contact/index.html

The title page is not hard at all. But there are several different techniques that could get you a title page:
1) use ODS TEXT= in FRONT of your first procedure for the TEXT of the TITLE page. Then change the style template so the USERTEXT attribute formats the TITLE lines the way you want.
2) create a SAS dataset with your title lines and then use PROC REPORT with the NOHEADER option to print the title lines. .... again, BEFORE your first procedure
3) similar to #2 -- use DATA _NULL_ to create your title page.

Any of these techniques would look like this:[pre]

ods pdf file='withtitle.pdf';

*** your chosen technique;

***first proc;

*** second proc;

ods pdf close;[/pre]

I do have an example of technique #2, but it is rather lengthy to post here. If you send me email to cynthia.zender@sas.com, I will send it to you.

Finally, if you want to put an image at the bottom of the page -- essentially you would have to put the image into a SAS footnore statement either using the PREIMAGE/POSTIMAGE attribute within the FOOTNOTE statement (and using ODS ESCAPECHAR) OR by changing the STYLE template so that the PREIMAGE/POSTIMAGE info is automatically used with the SAS FOOTNOTE. And then, of course, you have to use a FOOTNOTE. Attaching an image to your table is probably NOT a good idea, because TABLES can be of varying numbers of rows, so POSTIMAGE used with the TABLE would get you the image right underneath the TABLE.

Let me know by email if you'd like that example and I will send you the long example and then post a shorter version of technique #2 here.

cynthia
N/A
Posts: 0

Re: PDF, contents and creating a front page

Hi Cynthia,
I couldn't figure out how to send you an email... - So I'll have to answer here...

First of all thanks, your answers helped me a lot. I already tried the ods text solution to making a front page, however, I didn't succeed in getting the front page prior to the table of contents... - Can you give me a hint on that?

Once again: thanks a lot!
:-)
Jenny
SAS Employee
Posts: 50

Re: PDF, contents and creating a front page

Jenny,

I've tried numerous ways to create a blank page before the TOC created by the contents= option on the ODS PDF statement without good results. I have 2 suggestions:

(1) Create two PDF files...one for your title and the 2nd with your output (with the TOC). Then you can concatenate them both together.

(2) Contact Technical Support and open a track with them. They are the experts at stuff like this. There may a way around this that I haven't thought of yet.

Thanks!
Scott
SAS Super FREQ
Posts: 8,739

Re: PDF, contents and creating a front page

Jenny & Scott:
Here's an update on what I discovered. First...if you have the CONTENTS= options, and all your code (title created with ODS PDF text= and output with your procedures of choice) within 1 ODS PDF "sandwich" then here's the order your output is in (as you discovered):

TOC
TITLE page
Rest of OUTPUT

If you're printing, then that's not too bad because as the pages come off the printer, you can just swap out the TOC and the TITLE page. However, for an automated process that's not too great.

If you do this: [pre]

ODS PDF file='c:\temp\title1.pdf';
** code to gen title;
ODS PDF CLOSE;


ODS PDF file='c:\temp\output1.pdf' contents=yes
bookmarkgen=yes bookmarklist=hide;
** code to gen output PLUS contents;
ODS PDF CLOSE; [/pre]

Then the issue becomes how to concatenate the 2 files together. ODS PDF will NOT concatenate these 2 files together for you. Here's what I have discovered for the concatenation process.

1) some folks have had success with Ghostscript and DOS command line-like commands. (which you could put into a .BAT file) I could NOT get this method to work. I had Ghostscript 5.10 and the command line that I found in the doc just didn't work for me. I kept getting either font errors or just general Ghostscript errors.

2) use some other 3rd party product to do the concatenate.
a) This is the second method I investigated. Here's what I used:
Ghostscript 8.54 (free download)
BullZip Printer Driver (free download) http://www.softsea.com/review/BullZip-PDF-Printer.html If you do not have the right level of Ghostscript, then BullZip prompts you to download and install that first.

b) once the 2 products were on my system, I opened title1.pdf (from above program), I selected FILE --> PRINT and selected the BullZip Printer in the printer name drop down box. Then, the BullZip popup opened and asked me for a new file name AND gave me a chance to merge ONE other document with the currently open document. The output got created correctly, so that the 2 files (title1.pdf and output1.pdf) were not joined together in the file final1.pdf.

c) I suspect, but do not know for sure, that there is a way to execute the BullZip or Ghostscript 8.54 in batch mode to do the concatenate.

d) OR, if there's not a way to do this in a .bat file with BullZip that there is some other 3rd party product that would allow you to concatenate ODS PDF output files together.

cynthia
Ask a Question
Discussion stats
  • 4 replies
  • 700 views
  • 0 likes
  • 3 in conversation