The SAS Output Delivery System and reporting techniques

ODS PDF links

Reply
SAS Employee
Posts: 47

ODS PDF links

I'm doing a PROC REPORT with a variable that has 2 words: "LINK1 LINK2".
I know I can create a link like this:

COMPUTE MyVar;
urlstring="#JUMPTO";
CALL DEFINE('MyVar','url', urlstring);
ENDCOMP;

Is there a way that I can "LINK1 LINK2" become 2 links:
LINK1 --> #JUMPTO1
LINK2 --> #JUMPTO2

Thanks,
Lex Jansen
SAS Super FREQ
Posts: 8,864

Re: ODS PDF links

Hi:
I tried this with ODS ESCAPECHAR, but PDF seems to want only one link per "cell" -- so only the first link was used and when I clicked on the word, I got taken to www.setgame.com -- I used absolute URLs because it was the easiest way to test that the navigation did work.

[pre]

ods listing close;
ods pdf file='one_link.pdf';
ods escapechar='^';
proc report data=sashelp.class nowd;
title 'multiple links in one cell';
column name prtname age height;
define name / order noprint;
define prtname / computed;
define age /display;
define height /display;

compute prtname / character length=200;
urlstring1="http://www.setgame.com";
urlstring2="http://www.sas.com";
prtname = '^S={url="'||trim(urlstring1)||'"}'||name||'^S={} '||
' ^S={url="'||trim(urlstring2)||'"}'||'LINK2';
endcomp;
run;
ods pdf close;

[/pre]


Or, just make the second word a separate cell with its own link -- it that's an acceptable solution.
[pre]

data testit;
infile datalines dsd dlm=',';
input name $ twolink $;
return;
datalines;
anna,"a1 a2"
bob,"b1 b2"
carla,"c1 c2"
dave,"d1 d2"
eliza,"e1 e2"
frank,"f1 f2"
gail,"g1 g2"
;
run;

ods pdf file='this_works.pdf';
ods escapechar='^';
proc report data=testit nowd;
title 'two links with CALL DEFINE';
column name twolink link1 link2;
define name / order;
define twolink / display noprint;
define link1 /computed;
define link2 / computed;

compute link1 / character length=100;
urlstr1 = 'http://www.setgame.com';
link1 = scan(twolink,1,' ');
call define('link1','url',urlstr1);
endcomp;
compute link2 / character length=100;
urlstr2 = 'http://www.sas.com';
link2 = scan(twolink,2,' ');
call define('link2','url',urlstr2);
endcomp;
run;
ods pdf close;

[/pre]

I did get curious about what would happen if I took SAS out of the picture -- in so far as 2 links and PDF. So I made a Word doc with a table and in one cell, I put 2 words and put a link on each word. Then, I used my Adobe PDF button to convert the Word doc to PDF form. When I did things that way, the PDF file did have 2 separate links, one on each word.

I wonder whether this is an instance where you might use PDFMARK with a PostScript file. I have not played with PDFMARK much, but it says that:

PDFMARK
enables ODS to insert special tags into a PostScript file. When you use software such as Adobe Acrobat (not Adobe Viewer), Acrobat Distiller interprets the tags to create a PDF file that contains the following items:

bookmarks for each section of the output and for each table.

references for items that are associated with the URL= style attribute.

notes for items that are associated with the FLYOVER= style attribute. Notes are optional, and are based on the PDFNOTE option.

author, keywords, subject, and title in the metadata of a file.



You might consider contactingTech Support for more help on this issue -- they can consult with the PDF experts.


cynthia
SAS Employee
Posts: 47

Re: ODS PDF links

Posted in reply to Cynthia_sas
Cynthia,

Thanks for the extensive reply.
I had been thinking about using ODS PRINTER and then post-processing the postscript file before sending it to Distiller.

I presented a paper in 1999 (PRE-ODS days!) titled:
"Creating PDF documents including links, bookmarks and a Table of Contents with the SAS®software"
(http://www.lexjansen.com/seugi)
I used PDFMARK operators in it, so I might go that route.

What I find out might be good stuff for a new paper!

Cheers,

Lex
Ask a Question
Discussion stats
  • 2 replies
  • 171 views
  • 0 likes
  • 2 in conversation