BookmarkSubscribeRSS Feed
Kandi
Calcite | Level 5
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?
5 REPLIES 5
Cynthia_sas
SAS Super FREQ
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]
Lex_SAS
SAS Employee
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
Cynthia_sas
SAS Super FREQ
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]
Lex_SAS
SAS Employee
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
Cynthia_sas
SAS Super FREQ
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

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 5 replies
  • 1633 views
  • 0 likes
  • 3 in conversation