Desktop productivity for business analysts and programmers

Changing Bookmark labels when using ODS PDF

Reply
N/A
Posts: 1

Changing Bookmark labels when using ODS PDF

How do I change pdf bookmark labels in an ODS pdf statement to equal the title for each Proc Report when I have multiple Proc Report statements within the same ods statement?
SAS Super FREQ
Posts: 8,716

Re: Changing Bookmark labels when using ODS PDF

Hi:
Two ways to touch bookmarks are:
1) ODS PROCLABEL statement BEFORE each PROC REPORT or
2) CONTENTS= option on each proc report statement.

cynthia

[pre]
ods pdf file='lovelucy.pdf';

ods proclabel 'Lucy';
Proc report data=sashelp.class nowd
contents='Love Lucy';
run;

ods proclabel 'Ethel';
Proc report data=sashelp.class nowd
contents='Ethel Rocks';
run;
ods pdf close;
[/pre]
SAS Employee
Posts: 47

Re: Changing Bookmark labels when using ODS PDF

When I run this code in 9.1.3 I get the following bookmarks:

Lucy
+---Love Lucy
Ethel
+---Ethel Rocks

Great!
But in 9.2 I get bonus bookmarks:

Lucy
+---Love Lucy
+---Table1
Ethel
+---Ethel Rocks
+---Table1

Is there any option that will get rid of the Table1 bookmarks?
Or do I have to start using ODS Document to fix this compatibility issue ?

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

Re: Changing Bookmark labels when using ODS PDF

Hi:
Ah, you're right. It's a feature that the extra level got introduced, as described here:
http://support.sas.com/kb/31/278.html

To cope with it, there's a new capability -- contents= on the BREAK before xxx statement -- that will allow you to either name it or disappear it. You have to make a "fake variable" to break on and use the PAGE option on the break statement, but it will do what you want. (Note that you will change the PDF bookmarks, but NOT the Results Windows nodes.)

cynthia
[pre]
data class;
set sashelp.class;
fakevar = 1;
run;

ods listing close;
ods pdf file='lovelucy.pdf';

ods proclabel 'Lucy';
Proc report data=class nowd
contents='Love Lucy';
column fakevar name age height sex;
define fakevar / order noprint;
break before fakevar / contents='Ricky' page;
run;

ods proclabel 'Ethel';
Proc report data=class nowd
contents='Ethel Rocks';
column fakevar name age height sex;
define fakevar / order noprint;
break before fakevar / contents='' page;
run;
run;
ods pdf close;
[/pre]
SAS Employee
Posts: 47

Re: Changing Bookmark labels when using ODS PDF

Thanks, Cynthia!

It works, but it does get a little hard to maintain code that has to be compatible with older versions.

Since the hyperlinks in my PROC REPORTS use absolute column references (like _c3_), I now have to update them (in this example to _c4_), since I added a fake variable.

Any ideas to prevent this, except adding a lot of code like this: %IF &sysvar=9.2 %THEN ...

Regards,
Lex Jansen Message was edited by: LexJ
SAS Super FREQ
Posts: 8,716

Re: Changing Bookmark labels when using ODS PDF

Hi, Lex:
I feel your pain. It's not the best solution if you have to maintain code for multiple versions -- especially with ACROSS variables in the mix. My tendency would be to modularize the code for each version -- create fakevar & shift the absolute columns for 9.2 and use the "old way" for 9.1.3 -- but maintain them as 2 separate programs.

Sorry, I don't have a better idea.

cynthia
Ask a Question
Discussion stats
  • 5 replies
  • 195 views
  • 0 likes
  • 3 in conversation