BookmarkSubscribeRSS Feed
Lex_SAS
SAS Employee
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
6 REPLIES 6
Cynthia_sas
SAS Super FREQ
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
Lex_SAS
SAS Employee
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
Cynthia_sas
SAS Super FREQ
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
Lex_SAS
SAS Employee
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 ....
Cynthia_sas
SAS Super FREQ
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
Lex_SAS
SAS Employee
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!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 824 views
  • 0 likes
  • 2 in conversation