BookmarkSubscribeRSS Feed
Palmer_D
Calcite | Level 5

Hi everyone, 

 

I'm trying to figure out how to include Excel bookmarks in my output file using ODS Excel.  Here is some example code: 

 

ods excel file = 'C:\Temp\Buy.xlsx';
	data _null_;
		set Sashelp.Buy end = done;
		if _n_ = 1 then
			do;
				array A[*]
						_all_
						_temporary_;
				declare odsout B();
				B.table_start();
					B.head_start();
						B.row_start();
							B.format_cell(text: 'Date');
							B.format_cell(text: 'Amount');
						B.row_end();
					B.head_end();
					B.body_start();
			end;
						B.row_start();
						do i = 1 to 2;
							B.format_cell(data: A[i]);
						end;
						B.row_end();
		if done then
			do;
					B.body_end();
				B.table_end();
			end;
	run;
	proc odstext;
		p 'Another output object';
	run;
ods excel close;

 

If you go to Home > Find & Select > Go To, you'll see the following: 

 

Go_To.png

 

I need each output object to be listed in this window.  The names aren't super important, although if there is a way to name them manually that would be nice.  It would also be nice to be able to bookmark the header and body of the Report Writing Interface separately, but that's also less important.  

 

I'm using SAS 9.4M5 on Windows 10.  

 

Thanks!  

4 REPLIES 4
Palmer_D
Calcite | Level 5

Hi Chris, 

 

Thank you for your reply!  

 

Yes, I've tried the anchor option.  I forgot to mention in my original post, but the two closest things I've tried are: 

 

1) Specifying the option anchor = 'Table1' (along with the dom option to display the html structure in the log).  This shows me how Table1 replaces IDX, the default value of ID= in the section tag.  The "Go To" window, however, is unchanged.  

 

2) Specifying the suboption (contents = 'on').  This creates another sheet with links to the output objects on the main sheet, but "Go To" remains empty for both sheets.  The fact that the Table of Contents sheet correctly identifies the cells in which I'm interested indicates to me that SAS knows how to communicate this information to Excel - I'm just not sure how to get it into the "Go To" window specifically.  

 

Thanks again!  

ChrisNZ
Tourmaline | Level 20

My version is so old that the anchor syntax is unsupported, so I can't help much more. Maybe @Cynthia_sas knows?

Cynthia_sas
SAS Super FREQ
Hi:
I think the closest you can get is the Table of Contents that ODS EXCEL generates. I am not sure that you have the ability to populate the "Go to" window in Excel. However, this would be a question for Tech Support. I believe that the ANCHOR= option really was only designed to work with the original ODS PDF and ODS HTML -- that feature was part of ODS for those 2 destinations and I do not believe it was retrofitted or revisited when ODS EXCEL came on the scene. Again, another question for Tech Support.
Cynthia

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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