bookmarks pdf

Occasional Contributor
Posts: 19

bookmarks pdf


I need your help to resolve a problem linked to the bookmark in pdf output

In fact we want produce a reporting with any proc sas within an ods PDF , and in the bookmarks we want put just the titles

For that we use ods document and proc document in order to trait the the bookmarks

Bellow  an example of program

Note : in this example we use the proc freq, but we can use any sas proc

The problem  : We can to insert the different levels of titles in the bookmarks , but there are a bookmark which is automatiquelly inserted in the last level of bookmarks as shown in the joined document



%macro test; 
ods _all_ close ;

ods document name=work.content(write);
title1 j=l "Mytitle1";
title2 j=l "Mytitle2";
title3 j=l "Mytitle3";
title4 j=l "Mytitle4";
title5 j=l "Mytitle5";
title6 j=l "Mytitle6";

footnote1 j=l "Myfootnote1";
footnote2 j=l "Myfootnote2";
footnote3 j=l "Myfootnote3"; 
footnote4 j=l "Myfootnote4"; 
footnote5 j=l "Myfootnote5"; 
footnote6 j=l "Myfootnote6"; 

proc freq  data=sashelp.class ; table Sex ; run ; 
ods document close;
ods output properties=tmp_contentds ;
proc document name=work.content;
list / levels=all ;
ods output close ;
data _null_;
set tmp_contentds(where=(type ne "Dir"));
call symput("mv_report"||strip(cpt), strip(path));
Call symput("mv_nbreport",strip(cpt));

proc document name=mydocrep(write);
make niv1;
dir \niv1;
setlabel \niv1 "Mytitle1";
make niv2;
dir \niv1\niv2;
setlabel \niv1\niv2 "Mytitle2";
make niv3;
dir \niv1\niv2\niv3;
setlabel \niv1\niv2\niv3 "Mytitle3";
make niv4;
dir \niv1\niv2\niv3\niv4;
setlabel \niv1\niv2\niv3\niv4 "Mytitle4";
make niv5;
dir \niv1\niv2\niv3\niv4\niv5;
setlabel \niv1\niv2\niv3\niv4\niv5 "Mytitle5";
make niv6;
dir \niv1\niv2\niv3\niv4\niv5\niv6;
setlabel \niv1\niv2\niv3\niv4\niv5\niv6 "Mytitle6";

%do i=1 %to &mv_nbreport. ; 
	copy \Work.content&&mv_report&i to ^; 

ods pdf dpi=350  style=Custom startpage=yes pdftoc=1 bookmarkgen ;
proc document name=work.mydocrep;
replay ;
ods pdf close ; 
 title ;

%mend ; 

%test ; 

Super User
Super User
Posts: 9,599

Re: bookmarks pdf

Yes, unfortunately creating these things seems limited in SAS - at least up to the version 9.4 which I am using.  We have to produce PDF's compiled from various outputs.  Never found a satisfactory method to create bookmarks.  I can suggest only that you investigate either tools to build a document with proper bookmarks, or write something yourself, for instance if you right click on a selection of RTF files, you can combine in Adobe, which gives you the option of setting bookmarks.  It can be automated in VBS.  If someone else has come up with a working solution that would be great, but I haven't seen one yet.

Posts: 825

Re: bookmarks pdf

[ Edited ]



Please have a look at the following paper It has some details on how to use statements and options to control the value of the bookmarks created. It also shows which procedure allow what level of control. This might give you some more ideas. If you can do what you need, I do not know.



Occasional Contributor
Posts: 19

Re: bookmarks pdf

Posted in reply to Bruno_SAS

hello Bruno

thank you for your response , but sorry the link does't work



Posts: 825

Re: bookmarks pdf

now the link is ok, there was an addtional period at the end.

Occasional Contributor
Posts: 19

Re: bookmarks pdf

Posted in reply to Bruno_SAS

Thank you for your response , it is a very interesting document

But I don’t have a solution for my problem, because in our specification, we can to have many sas proc to replay in ods pdf and the number of titles can vary between 1 to 6

For example If we have 1 titile and 2 proc , we can not put in the toc just the title



best regard 

Ask a Question
Discussion stats
  • 5 replies
  • 1 like
  • 3 in conversation