The SAS Output Delivery System and reporting techniques

Inserting a separate PDF file into ODS output

Reply
New Contributor
Posts: 4

Inserting a separate PDF file into ODS output

Hi,

I've got a program that generates PROC REPORT output into a PDF file. Now we want to prefix this file with a static page of text that describes the descriptions and assumptions of these reports.

If I did this in Adobe Acrobat, I'd use the File > Combine Files option and simply combine the two files into one. Is there a way to do this in SAS?

I guess I want an ODS PDF INSERTDOC= statement. :-)

Thanks,
Earl
SAS Employee
Posts: 50

Re: Inserting a separate PDF file into ODS output

Currently there is no way to merge PDF files within SAS. We are looking into that suggestion for a future release.

Thanks!
Scott
SAS Super FREQ
Posts: 8,862

Re: Inserting a separate PDF file into ODS output

Posted in reply to ScottH_SAS
Hi:
Even though there's no way to merge 2 PDF files together, you CAN create a COVER page when you need it by using a technique similar to that shown below.

Basically, use a DATA step to create a file that will become your "cover page" data and then use PROC REPORT with the NOHEADER option to display that data with all the interior table lines turned off. I kept my data really simple, I have an ORD variable and a NOTE variable. I use the ORD variable to make the first line bigger than the comment lines with a CALL DEFINE.

You could read the cover page text from a flat file, too and then tailor your PROC REPORT to the var names from the file. Although it's not the same as having the ability to combine 2 PDF files, if all you need is a simple cover page, then you CAN get it.

cynthia
[pre]

options nodate nonumber orientation=portrait;
data cover;
length ord 8 note $425;
ord = 1;
note = 'Assumptions';
output;
ord = 2;
note = '1) All data will be "scrubbed" and error-free.';
output;
ord = 3;
note = '2) All Sales are CLOSED status';
output;
ord = 4;
note = '3) Pending Sales must be closed by month-end date or they will be reported in the next month.';
output;
ord = 5;
note = '4) Sales under $500 show under MISC category, not under Order Type';
output;
ord=6;
note = '5) And this is a really, really, really, really, '||
'really, really, really, really, really, really, '||
'totally long, very long, comment. It includes '||
'the word "supercalifragilisticexpialidocious", even '||
'though the sound of it is something quite atrocious. '||
'You might prefer a comment that included jabberwocks '||
'and slithy toves and mimsy borogroves, but Alice decided '||
'that she really did not care to comment on the report.';
output;
run;

ods pdf file='c:\temp\coverpage.pdf';
title; footnote;
proc report data=cover nowd noheader
style(report)={rules=none frame=void cellspacing=0}
style(lines)={font_size=18pt font_style=italic font_weight=bold};
column ord note;
define ord / order noprint;
define note / display
style={font_weight=medium font_size=14pt just=l};
compute note;
if ord = 1 then
call define(_ROW_,'style',
'style={font_weight=bold font_size=18pt just=c}');
endcomp;
compute after;
line ' ';
line ' ';
line 'Company Confidential';
endcomp;
run;

proc report data=sashelp.shoes nowd;
title 'Sales Report';
where region in ('Asia', 'Canada');
column region product sales;
define region / group;
define product / group;
define sales/ sum;
rbreak after/ summarize;
run;

ods pdf close;

[/pre]
New Contributor
Posts: 4

Re: Inserting a separate PDF file into ODS output

Posted in reply to Cynthia_sas
Thanks, Scott and Cynthia.

Cynthia, your supercalifragilisticexpialidocious example was my "Plan B." I guess I'll implement it.

Earl
SAS Super FREQ
Posts: 8,862

Re: Inserting a separate PDF file into ODS output

With a spoonful of sugar, I hope!
Ask a Question
Discussion stats
  • 4 replies
  • 142 views
  • 0 likes
  • 3 in conversation