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 :
... and what I need is ...
Any help on this???
Thanks,
Michael
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;
Hi:
You didn't post data or your style. However, this is what I send to my students as a starter example:
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
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
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:
and, again, you would need to use the Tech Support example to change or eliminate the "Table 1" node.
Cynthia
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;
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;
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
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.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.