04-19-2016 11:07 AM
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 ; run; quit; ods output close ; data _null_; set tmp_contentds(where=(type ne "Dir")); cpt+1; call symput("mv_report"||strip(cpt), strip(path)); Call symput("mv_nbreport",strip(cpt)); run; 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 ^; %end; quit; ods pdf dpi=350 style=Custom startpage=yes pdftoc=1 bookmarkgen ; proc document name=work.mydocrep; replay ; quit; ods pdf close ; title ; footnote; %mend ; %test ;
04-19-2016 12:11 PM
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.
04-19-2016 03:00 PM - edited 04-19-2016 04:00 PM
Please have a look at the following paper http://support.sas.com/resources/papers/proceedings11/252-2011.pdf 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.
04-20-2016 09:03 AM
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