BookmarkSubscribeRSS Feed
woshibug
Fluorite | Level 6

I searched in community and find the following code to create the hyperlink in pdf that can link to a external url of any website.

OPTION NODATE NONUMBER;
OPTIONS PAPERSIZE=A4;
OPTIONS TOPMARGIN=0.5 in BOTTOMMARGIN=0.5 in LEFTMARGIN=0.5 in RIGHTMARGIN=0.5 in;
ODS NORESULTS;
ODS PDF FILE = "E:\Desktop\TEST.pdf" dpi=1800;

data _NULL_;
set SASHELP.CLASS(obs=1);
declare odsout obj();
obj.format_text( data: "Information:",
overrides: " just=left color=green font_weight=bold font_size=8pt ");
obj.href(data:
"Adresse", url: 'https://www.test.fr/', inline_attr:'color=blue');
Run;

ODS PDF CLOSE;

But what I want is adding some internal and not external hyperlink above for a pdf like TOC(table of content) in the first page of a present pdf which has already existed. My confusion is how to add a internal and local hyperlink for a preexisting pdf.

3Q

5 REPLIES 5
Ksharp
Super User

Here is an example :

 

ods pdf file='c:\temp\temp.pdf';

title link='#xxxxx' 'whatever it is';
proc report data=sashelp.class nowd;
compute age;
if age.sum=12 then call define(_col_,'url','#yyyyy');
endcomp;
run;


ods anchor='xxxxx';
title 'heart';
proc print data=sashelp.heart(obs=10);run;

ods anchor='yyyyy';
title 'cars';
proc print data=sashelp.cars(obs=10);run;

ods pdf close;
woshibug
Fluorite | Level 6
3q,but your example above is also create a pdf,it is not a preexisting pdf.
Ksharp
Super User
You want edit already exist pdf file ? I doubt sas have such ability .
woshibug
Fluorite | Level 6
I create the hyperlink into RTF format document,then convert it into pdf and the hyperlink can work normal. but when
the data is very big and I cant get the combined RTF,so I transform lots of single rtf into single pdf,then use some app to combine pdf,then the original hyperlink can‘t work.
Ksharp
Super User
"then use some app to combine pdf,then the original hyperlink can‘t work."

That should be . sas doesn't have much control on PDF. especially for combined pdf .

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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