BookmarkSubscribeRSS Feed
yy2018
Calcite | Level 5

When creating ods pdf files for an analysis, is there a way to generate bookmarks for a paragraph of texts where there's no tables or graphs printed?

4 REPLIES 4
SuzanneDorinski
Lapis Lazuli | Level 10

It might depend on how you are adding the text.  If you use PROC ODSTEXT, you can create a bookmark with the ODS PROCLABEL statement.

 

Here's some example code.

 

options nodate;

ods pdf file='/folders/myfolders/SAS Communities/Bookmarks for PROC PRINT and PROC ODSTEXT.pdf'
  contents;

ods proclabel='Happy SAS University Edition user';

proc odstext contents='';
  h1 'Happy SAS University Edition user' / style=[just=c];
  p 'This is just some random text that I wrote to show up before the PROC PRINT output. 
User posted a question on SAS Communities asking if there is a way to add a PDF bookmark 
for paragraphs of text in the file that are NOT related to tables or graphics.  ';
  p 'I just updated my version of SAS University Edition at home to Release 3.71.  I really 
enjoy working with SAS University Edition, because it allows me to try out the new techniques 
and syntax while I wait for SAS to be upgraded at work.';
run;

ods proclabel='Major League Baseball players in Ohio in 1986';

proc print data=sashelp.baseball(where=(team in ('Cleveland','Cincinnati'))) noobs 
       contents='';
  title 'Major League Baseball data from 1986';
  var name team league division position;
run;

title;
ods pdf startpage=now; ods proclabel='Some thoughts on sports fans in Ohio'; proc odstext contents=''; h1 'Some thoughts on sports fans in Ohio' / style=[just=c]; p 'People who grow up in Northeast Ohio tend to be fans of the Cleveland Indians, while those who grow up near Cincinnati tend to be fans of the Cincinnati Reds. LeBron James is a notable example of a person who grew up in Northeast Ohio but preferred the New York Yankees.'; p 'People who grow up in Columbus generally pick between the Cleveland Indians and the Cincinnati Reds. Columbus is much more of a college football town, which is understandable, as it is home for The Ohio State University Buckeyes!'; run; ods pdf close;

The code produces a PDF with some text on one page, followed by a page with a table, followed by another page with some text.  

The screen shot below shows the bookmarks.

 

ODS PROCLABEL statement can create a bookmark for PROC ODSTEXTODS PROCLABEL statement can create a bookmark for PROC ODSTEXT

yy2018
Calcite | Level 5

Nice. Thank you for your great help! 

 

However here's an issue with bookmarks -- when I click on a bookmark, I am not taken immediately to that line (which is what I would have expected when I click on a bookmark).  I am taken close to the spot but not quite to the spot, which is a bit annoying.  Any insight on how to resolve it or it is just how these bookmarks are built to do?

SuzanneDorinski
Lapis Lazuli | Level 10

I've seen the same thing with bookmarks created based on Word document headings.  I don't know if there's a better way.  Perhaps @Cynthia_sas may have some thoughts.

ballardw
Super User

@yy2018 wrote:

Nice. Thank you for your great help! 

 

However here's an issue with bookmarks -- when I click on a bookmark, I am not taken immediately to that line (which is what I would have expected when I click on a bookmark).  I am taken close to the spot but not quite to the spot, which is a bit annoying.  Any insight on how to resolve it or it is just how these bookmarks are built to do?


Which PDF file viewer are you using? There might be some difference depending on the viewer.

 

Any you might need to share some code that you are using. Since we have no results to examine or any idea of how the document was generated you're going to get generic "might be this" answers. And without knowing how it was made it is hard to show even possible solutions.

 

As a minimum code examples should show ODS PDF (so we see all the PDF options applied) to the ODS PDF Close statements with one or more output generators that would duplicate the behavior you get. Ideally using supplied SAS data sets so we don't have make fake data or have you worry about sharing sensitive data.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 3281 views
  • 1 like
  • 3 in conversation