BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Michael_P
Calcite | Level 5

Hi all,

I am trying to create a PDF file with multlevel bookmarks.

The code I am using is ...

ods pdf file="site_listings.pdf" style=us_land nogtitle nogfootnote;

ods proclabel="Site 1001" ;
title 'Demographics';
Proc report data=a contents= 'Demographics' nowd;
Columns var;
Define var /display;
Run;

ods proclabel="Site 1001" ;
title 'Disposition';
Proc report data=b contents= 'Disposition' nowd;
Columns var;
Define var /display;
Run;

ods proclabel="Site 1001" ;
title 'Adverse Events';
Proc report data=c contents= 'Adverse Events' nowd;
Columns var;
Define var /display;
Run;

ods pdf close;

What I get is :

 

Michael_P_0-1703166640247.png

 

... and what I need is ...

 

Michael_P_1-1703166817023.png

Any help on this???

Thanks,

Michael

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

Finally I used @Andre 's code in this :

https://communities.sas.com/t5/ODS-and-Base-Reporting/Second-level-bookmarks-pdf/td-p/117003

 

and get it worked.

 

 


data a;
set sashelp.class; 
xc=1;
run;
ods document name=testAW(write); Proc report data=a nowd; Columns xc name age weight height; define xc /order noprint; Define name /display; Define age/display; Define weight/display; Define height/ display; Where weight <95; break before xc / contents="" page; Run; Proc report data=a nowd; Columns xc name age weight height; define xc /order noprint; Define name /display; Define age/display; Define weight/display; Define height/ display; Where weight >=95; break before xc / contents="" page; Run; ods document close;
proc document name=testAW; list/ levels=all; run; quit; proc document name=testAW2(write); make \CLASS; setlabel \Class#1 "Site 1001"; make \Class#1\Tab1; setlabel \Class#1\Tab1#1 "weight < 95"; copy \work.testAW\Report#1\Report#1\Report#1 to \Class#1\Tab1#1; make \Class#1\Tab2; setlabel \class#1\Tab2#1 "weight >95"; copy \work.testAW\Report#2\Report#1\Report#1 to \Class#1\Tab2#1; run; make \CLASS2; setlabel \Class2#1 "Site 1002"; make \CLASS2#1\Tab1; setlabel \Class2#1\Tab1#1 "Demographics"; copy \work.testAW\Report#1\Report#1\Report#1 to \Class2#1\Tab1#1; make \CLASS2#1\Tab2; setlabel \class2#1\Tab2#1 "Disposition"; copy \work.testAW\Report#2\Report#1\Report#1 to \Class2#1\Tab2#1; make \CLASS2#1\Tab3; setlabel \class2#1\Tab3#1 "Adverse Events"; copy \work.testAW\Report#1\Report#1\Report#1 to \Class2#1\Tab3#1; run; list/ levels=all; run; quit; proc document name=work.testAW2; ods pdf file="c:\temp\twolevels.pdf"; replay; run; ods pdf close; quit;

 

Ksharp_0-1703483282754.png

 

 

 

View solution in original post

10 REPLIES 10
Cynthia_sas
Diamond | Level 26

Hi:

  You didn't post data or your style. However, this is what I send to my students as a starter example:

Cynthia_sas_0-1703173085113.png

  Then, to get rid of or change the final "Table 1" node, you need to follow the example in this Tech Support note: https://support.sas.com/kb/31/278.html .

Cynthia

Michael_P
Calcite | Level 5

Hi,

thanks for your reply!

The point is that I want to have two levels of Bookmarks - first level for the site and second level for the different reports.

Following your suggestion I would have only the second levels.

Michael

 

Cynthia_sas
Diamond | Level 26

Hi:

  As I explained, that was intended as a starter example that you would modify as you see fit. Here's a modified version of that example:

Cynthia_sas_0-1703174837403.png

and, again, you would need to use the Tech Support example to change or eliminate the "Table 1" node.

Cynthia

Ksharp
Super User

If your sub-report have the same constructure . You could try this .

But I don't know how to remove '=' in Bookmarks , Maybe @Cynthia_sas  knew it .

I think you should contact SAS Technique Support for this special question.

 

proc sort data=sashelp.class out=have;
by sex;
run;
data have;
 set have;
 _count=1;
 label sex='09'x;
run;

options nobyline;
ods pdf file='c:\temp\temp.pdf';
ods proclabel='SiteID: 01';
title "SEX is #byval1";
proc report data=have nowd contents='';
by sex;
column name age weight height _count;
define _count/order noprint;
break before _count/page contents='';
run;
ods pdf close;

Ksharp_0-1703214938494.png

 

 

Cynthia_sas
Diamond | Level 26
Hi:
I would not pad the BY variable with a hex character. And it didn't look like the OP was doing BY group processing. My approach would probably be to use ODS DOCUMENT/PROC DOCUMENT to restructure the Table of Contents and replay the tables in the structure I wanted.
Cynthia
Ksharp
Super User
Cynthia,
I also want to know how to get the bookmarks OP want in PDF file.
Can you show an example of ODS DOCUMENT/PROC DOCUMENT ?
Ksharp
Super User

Finally I used @Andre 's code in this :

https://communities.sas.com/t5/ODS-and-Base-Reporting/Second-level-bookmarks-pdf/td-p/117003

 

and get it worked.

 

 


data a;
set sashelp.class; 
xc=1;
run;
ods document name=testAW(write); Proc report data=a nowd; Columns xc name age weight height; define xc /order noprint; Define name /display; Define age/display; Define weight/display; Define height/ display; Where weight <95; break before xc / contents="" page; Run; Proc report data=a nowd; Columns xc name age weight height; define xc /order noprint; Define name /display; Define age/display; Define weight/display; Define height/ display; Where weight >=95; break before xc / contents="" page; Run; ods document close;
proc document name=testAW; list/ levels=all; run; quit; proc document name=testAW2(write); make \CLASS; setlabel \Class#1 "Site 1001"; make \Class#1\Tab1; setlabel \Class#1\Tab1#1 "weight < 95"; copy \work.testAW\Report#1\Report#1\Report#1 to \Class#1\Tab1#1; make \Class#1\Tab2; setlabel \class#1\Tab2#1 "weight >95"; copy \work.testAW\Report#2\Report#1\Report#1 to \Class#1\Tab2#1; run; make \CLASS2; setlabel \Class2#1 "Site 1002"; make \CLASS2#1\Tab1; setlabel \Class2#1\Tab1#1 "Demographics"; copy \work.testAW\Report#1\Report#1\Report#1 to \Class2#1\Tab1#1; make \CLASS2#1\Tab2; setlabel \class2#1\Tab2#1 "Disposition"; copy \work.testAW\Report#2\Report#1\Report#1 to \Class2#1\Tab2#1; make \CLASS2#1\Tab3; setlabel \class2#1\Tab3#1 "Adverse Events"; copy \work.testAW\Report#1\Report#1\Report#1 to \Class2#1\Tab3#1; run; list/ levels=all; run; quit; proc document name=work.testAW2; ods pdf file="c:\temp\twolevels.pdf"; replay; run; ods pdf close; quit;

 

Ksharp_0-1703483282754.png

 

 

 

Michael_P
Calcite | Level 5

Hi Ksharp,

thanks for that! Using the proc document is a nice easy solution - like it!

Even the code of ChrisNZ it is ok now 🙂 

Michael

narravulap
Fluorite | Level 6

i have issue with the output of proc document,'

 

i have 300 characters that need to be printed in proc document but it is showing only 244 characters.

 

input:

 

proc document name=work.tables;
 setlabel \EXXXXXX "EXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
 setlabel \EXXXXXX  "EXXXXXX- XXXXXXXXXXXXXXXXXXXXXXXXXX";
 run;

 

Output:

EXXXXXX "EXXXXXXX

EXXXXXX  EXXXXXX- XXXXXXXXXXXXXXXXXXXXXXXXXX

 

the first one not printing fully, only 244 characters are printing, how to increase the length to print more.

 

@Ksharp @Ksharp 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 10 replies
  • 4777 views
  • 0 likes
  • 4 in conversation