The SAS Output Delivery System and reporting techniques

ODS PDF document information

Reply
SAS Employee
Posts: 47

ODS PDF document information

When I want to create a PDF file with document information, I can use ODS PDF options like AUTHOR=, KEYWORDS=.
However, it looks like the ODS PDF COLUMNS= statement resets these options.
See example below. The first PDF file has the document information, but the second one does not. You can ceck this information in Acrobat with File, Properties, Description.

Any idea why I loose the information after specifying the COLUMNS= statement and how to solve this?

DATA class;
SET sashelp.class
sashelp.class
sashelp.class
sashelp.class ;
RUN;

ODS PDF FILE="test1.pdf"
AUTHOR="Donald Duck"
KEYWORDS="Disney";
PROC PRINT DATA=class;
RUN;
ODS PDF CLOSE;

ODS PDF FILE="test2.pdf"
AUTHOR="Donald Duck"
KEYWORDS="Disney";
ODS PDF COLUMNS=2;
PROC PRINT DATA=class;
RUN;
ODS PDF CLOSE;

Thanks,
Lex Jansen
SAS Super FREQ
Posts: 8,740

Re: ODS PDF document information

Lex,
what happens if you do this:
[pre]
ODS PDF FILE="test2.pdf"
AUTHOR="Donald Duck"
KEYWORDS="Disney"
COLUMNS=2;
PROC PRINT DATA=class;
RUN;

ODS PDF CLOSE;
[/pre]

(keep columns=2 on the original invocation???)

just curious. I'm on a computer without SAS right now, or I'd check. I'm guessing that somehow COLUMNS=2 on a separate invocation statement does something to the document metadata. I'm just wondering whether the same thing will happen on a more standard invocation (where the metadata about author & columns are in the same place.

cynthia
SAS Employee
Posts: 47

Re: ODS PDF document information

Cynthia,

Thanks, that worked.
My only problem is now that I have several PROC REPORTs going into the same PDF file and I have to change the COLUMNS between different PROC REPORTS.

Btw: the AUTHORS and KEYWORDS options can only be used when initializing a destination. Right?

Lex
SAS Super FREQ
Posts: 8,740

Re: ODS PDF document information

Lex, I believe that's correct....it's only 1 document, so you couldn't change author or keywords in the middle. OK, if that worked, how about this:

[pre]
ods pdf file='yadayada.pdf';
ods pdf columns=2 author='lex1' keywords='great report1 ';
** proc report 1;

ods pdf columns=1 author='lex2' keywords='great report 2';
** proc report 2;

ods pdf columns=2 author='lex3' keywords='great report 3';
** proc report 3;
ods pdf close;
[/pre]

I'm betting that IF it allows author & keywords, then ODS PDF will use the 3rd specification (which means you'd only have to do issue the author/keywords before the last report).

cynthia
SAS Employee
Posts: 47

Re: ODS PDF document information

No, did not work.
I get errors like:
WARNING: The KEYWORDS option was specified but the destination was already open. This option can only be specified when initializing the
destination; the new value will be ignored.
WARNING: The AUTHOR option was specified but the destination was already open. This option can only be specified when initializing the
destination; the new value will be ignored.

BUT .... I still have the metadata in my document ('lex1' and 'great report 1')

If I use the following code, I will lose my metadata:

[pre]
ods pdf file='yadayada.pdf';
ods pdf columns=2 author='lex1' keywords='great report1 ';
** proc report 1;
ods pdf columns=1;
** proc report 2;
ods pdf columns=2;
** proc report 3;
ods pdf close;
[/pre]

Seems like bug to me ....
SAS Super FREQ
Posts: 8,740

Re: ODS PDF document information

Interesting. It -does- make sense that the metadata for the document would be created when the document is initialized. Not sure why it gets reset if you have COLUMNS=, that seems a bit wonky. I think it's worth opening a track with Tech Support so the question goes to the ODS folks.

cynthia
SAS Employee
Posts: 47

Re: ODS PDF document information

It gets even more interesting.
The following code gives no errors and will use the last specification.

[pre]
ods pdf file='yadayada.pdf';
ods pdf columns=2 author='lex1' keywords='great report1 ';
** proc report 1;
ods pdf columns=1;
** proc report 2;
ods pdf columns=2 author='lex3' keywords='great report3 ';
** proc report 3;
ods pdf close;
[/pre]

And I can even do this (without errors or warnings):

[pre]
ods pdf file='yadayada.pdf';
ods pdf columns=2';
** proc report 1;
ods pdf columns=1;
** proc report 2;
ods pdf columns=2 author='lex3' keywords='great report3 ';
** proc report 3;
ods pdf close;
[/pre]

or this:

[pre]
ods pdf file='yadayada.pdf';
ods pdf columns=2';
** proc report 1;
ods pdf columns=1;
** proc report 2;
ods pdf columns=2;
** proc report 3;
ods pdf author='lex3' keywords='great report3';
ods pdf close;
[/pre]

In both last cases I get the metadata.
So, I think I have it solved.
I will issues the metadata before I close the PDF destination.

Have a great holiday!
Ask a Question
Discussion stats
  • 6 replies
  • 198 views
  • 0 likes
  • 2 in conversation