BookmarkSubscribeRSS Feed
swfouchier
Calcite | Level 5

Hi,

Is there a way to control the collapse of bookmarks in a 3-level bookmarked pdf that is generated via ods pdf?

When generating a pdf I use pdftoc=1 to only show the first level bookmark when opening the pdf, but when I open the top-level bookmark it expands the second and third level bookmarks simultaneously. Is it possible, when opening the top-level bookmark, only all second level bookmarks are showing and keep all third level bookmarks closed? I am looking for a solution directly involving the ods pdf destination or any other options within SAS and NOT for a solution that requires any "external" pdf software.

 

Thus, when opening APPENDIX D,

swfouchier_0-1611386474787.png

instead of getting:

swfouchier_1-1611386512004.png

I would like to get this:

swfouchier_2-1611386553044.png

 

 

2 REPLIES 2
Ksharp
Super User

It is not easy to control PDF bookmarker in SAS . 

How did you create PDF file ?

 

proc report data=define_xml nowd split="*" contents="" 
                     style(report)={outputwidth=100% rules=all}
                     style(header)={font_weight=bold} ;
	columns memname name label type length _id_;
                     define memname/display noprint;
					 define _id_/order noprint;
					 compute dictionary;
                      rtag = "#"||strip(name);
                      call define(_col_,"url",rtag);
                      call define(_col_,"style","style={foreground=blue}");
					  n+1;
                      if mod(n,2)=1 then call define(_row_,"style","style={background=verylightgrey}");
                     endcomp;
					 break before _id_/page contents="";
                   run;
swfouchier
Calcite | Level 5

To control bookmarks I am using ods document.

First I have individual SAS program that can contain several proc report. My general set-up is similar to your code:

ods document name=items.section1(write);
title1 justify = left "Table 14.0.0.0";
ods proclabel = "Table 14.0.0.0";
proc report data = T14000 headline headskip nocenter nowindows missing contents="" split='~' style(header)=[just=right] 
                          style(column)=[just=right] style(report)=[cellpadding=0.8];
  columns pageno_ pageno sort1 grp1 trt1;
   define pageno_ / order order=internal noprint;
   define pageno  / order order=internal noprint;
   define sort1   / order order=internal noprint;
   define grp1    / style(column)=[cellwidth=1.9in just=left] "Protocol Deviation Term" style(header)=[just=left];
   define trt1    / style(column)=[cellwidth=1.3in];
  break before pageno_ / page contents="" ;
run;

title1 justify = left "Table 14.0.0.1";
ods proclabel = "Table 14.0.0.1";
proc report data = T14001 headline headskip nocenter nowindows missing contents="" split='~' style(header)=[just=right] 
                          style(column)=[just=right] style(report)=[cellpadding=0.8];
  columns pageno_ pageno sort1 grp1 trt1;
   define pageno_ / order order=internal noprint;
   define pageno  / order order=internal noprint;
   define sort1   / order order=internal noprint;
   define grp1    / style(column)=[cellwidth=1.9in just=left] "Protocol Deviation Term" style(header)=[just=left];
   define trt1    / style(column)=[cellwidth=1.3in];
  break before pageno_ / page contents="" ;
run;
ods document close;

Then I do a proc document (update) to add a new level 1 bookmark, lets call it "Section 1" and place all proc reports (T14.0.0.0 and T14.0.0.1) underneath.

proc document name=items.section1(update);
make section;
dir \ section#1;
setlabel \ section#1 "Section 1";
%macro loop;
  %local i table;
  %do i=1 %to %sysfunc(countw(&tables.));
    %let table = %scan(&tables., &i.);
    move \&table.#1 to ^;
  %end;
%mend loop;
%loop;
run;
quit;

I create an in-between pdf for Section 1 to evaluate and validate results per section by re-running item section 1 within an ods pdf.

 

To create a final master pdf containing all sections, I first create a master item, in which all section items a replayed, followed by a proc document (update) to add the title "APPENDIX D"

ods document name=items.masteritem(write);
%macro loop;
  %local i section;
  %do i=1 %to %sysfunc(countw(&sections.));
    %let section = %scan(&sections., &i.);
    proc document name=items.&section.(read);
    replay \&section.;
    run;
    quit;
  %end;
%mend loop;
%loop;
ods document close;

proc document name=items.masteritem(update);
make master;
dir \ master#1;
setlabel \ master#1 "APPENDIX D";
%macro loop;
%local i section;
%do i=1 %to %sysfunc(countw(&sections.));
%let section = %scan(&sections., &i.);
move \&section.#1 to ^;
%end;
%mend loop;
%loop;
run;
quit;
 

 

 

 

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1000 views
  • 0 likes
  • 2 in conversation