BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
cxterm
Fluorite | Level 6

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 

MaxthonSnap20190305112214.jpg

 

What I really want is like this

 

MaxthonSnap20190305112444.jpg

 

Is any possible to do that? Thanks in advnce!

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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;

 

View solution in original post

4 REPLIES 4
ballardw
Super User

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;

 

cxterm
Fluorite | Level 6

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>

 

 

ballardw
Super User

@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.

cxterm
Fluorite | Level 6
Anyway, thank for youe help.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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