Hello,
When I create a PDF report using RWI, the automatic bookmark all is 'Data NULL Table'. odf proclabel can only change the toplevel. Below is a example, How could I change the bookmark of those two table to 'Sex=F' and 'Sex=M'?
ods listing close;
ods pdf file="c:\test.pdf";
ods proclabel="Sample Report";
proc sort data=sashelp.class out=class;
by SEX;
run;
data _null_;
set class end=EOF;
by SEX;
if _N_ = 1 then do;
dcl odsout o();
o.table_start();
end;
if first.SEX and _N_ > 1 then do;
o.table_end();
o.page();
o.table_start();
end;
o.row_start();
o.format_cell(data: Name);
o.format_cell(data: Age);
o.row_end();
if last.SEX then do;
o.table_end();
end;
if EOF then do;
o.delete();
end;
run;
ods pdf close;
ods listing;
The bookmake in this pdf is like
What I really want is like this
Is any possible to do that? Thanks in advnce!
This works for your specific example
ods pdf file="c:\test.pdf"; ods proclabel="Sample Report"; proc sort data=sashelp.class out=class; by SEX; run; data _null_; set class end=EOF; by SEX; if _N_ = 1 then do; dcl odsout o(); /* o.table_start(); */ end; if first.SEX /*and _N_ > 1*/ then do; /* o.table_end();*/ o.page(); o.table_start(Label:'Sex='||Sex); end; o.row_start(); o.format_cell(data: Name); o.format_cell(data: Age); o.row_end(); if last.SEX then do; o.table_end(); end; if EOF then do; o.delete(); end; run; ods pdf close;
I made the table start condtional on the first.sex a bit differently so I hope the rest is sufficient;
This works for your specific example
ods pdf file="c:\test.pdf"; ods proclabel="Sample Report"; proc sort data=sashelp.class out=class; by SEX; run; data _null_; set class end=EOF; by SEX; if _N_ = 1 then do; dcl odsout o(); /* o.table_start(); */ end; if first.SEX /*and _N_ > 1*/ then do; /* o.table_end();*/ o.page(); o.table_start(Label:'Sex='||Sex); end; o.row_start(); o.format_cell(data: Name); o.format_cell(data: Age); o.row_end(); if last.SEX then do; o.table_end(); end; if EOF then do; o.delete(); end; run; ods pdf close;
I made the table start condtional on the first.sex a bit differently so I hope the rest is sufficient;
Thank you! It works as I want.
More questions:
1. If I do not want a table in bookmark, for example, the 'Sex = F', how could I do that? use label: '' result a blank bookmark entry. I do really want to remove that entry. like below:
Sample Report
Sex = M
2. If I want to move the 'Sex = F' to third level entry, is it possible? how could I do that?
Sample Report <--- First level>
Sex = M <----Second level>
Sex=F <----Third level>
@cxterm wrote:
Thank you! It works as I want.
More questions:
1. If I do not want a table in bookmark, for example, the 'Sex = F', how could I do that? use label: '' result a blank bookmark entry. I do really want to remove that entry. like below:
Sample Report
Sex = M
2. If I want to move the 'Sex = F' to third level entry, is it possible? how could I do that?
Sample Report <--- First level>
Sex = M <----Second level>
Sex=F <----Third level>
Beyond my skill set at this point. I seldom work with PDF or table of content entries and haven't really got much of an idea how to control TOC levels.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.