BookmarkSubscribeRSS Feed
reznac
Obsidian | Level 7

Hello,

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 ; 

test.JPG
5 REPLIES 5
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

BrunoMueller
SAS Super FREQ

Hi

 

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.

 

Bruno

reznac
Obsidian | Level 7

hello Bruno

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

 

Nacer

BrunoMueller
SAS Super FREQ

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

reznac
Obsidian | Level 7

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 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

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
  • 1865 views
  • 1 like
  • 3 in conversation