Usage Note 24174: How do links work under PDF in ODS?
The links are somewhat malformed in SAS 8.2 (see FAQ 4150; this has been fixed in SAS 9). But the
error in the formation of the links will not cause a problem for most of
you. So here is the theory of how they are supposed to work (and they
nearly do work this way).
To generate a link in PDF, use the same mechanism that you use in
HTML; either the URL= style attribute or the _URL_ property in PROC
REPORT. The difference lies in how they are interpreted:
- If the URL begins with HTTP: then it is
interpreted as an actual URL. Adobe Acrobat Reader
passes it on to the operating system, which typically
pops up your favorite Web browser on the specified URL.
- If the URL begins with #, then it is interpreted as a link
internal to the current document, using direct PDF commands to jump
internally. (See instructions below for creating links
within an ODS PDF document.)
- If neither of the above two cases apply, and
if the URL ends in .PDF or contains .PDF#, then
it is interpreted as a direct link to another
PDF file and bypasses the URL mechanism.
This means that Acrobat Reader
jumps directly to the other PDF document rather than going to a
browser and then having the browser invoke another PDF reader.
- If none of the above are true,
then the link is treated as a URL (just like the HTTP: case).
How to Link to Other Pages within an ODS PDF File
Beginning with SAS 9, you can link to any page within the PDF file.
The example code here works with SAS 9 and later.
Like other destinations, the PDF destination automatically generates link names with the following naming convention: IDX-IDXn. See example 1 below.
Example 2 is the preferred method of linking. Instead of using the
automatic anchors, the ANCHOR= option specifies
#PRINT, #STANDARD, and #TRANSPOSED
on the ODS PDF statements.
However, if a single procedure (like GLM) produces many tables, then example 1 is the
only alternative.
/* Example 1 */
proc template;
define style styles.mystyle;
parent=styles.printer;
style UserText from Note
"Controls the TEXT= style" /
font_size=15pt
font_weight=bold
just=c
;
end;
run;
ods pdf file="tt.pdf" style=styles.mystyle;
ods escapechar="^";
title "Contents";
ods pdf text="^S={URL='#IDX'}PROC PRINT";
ods pdf text="^S={URL='#IDX1'}PROC STANDARD";
ods pdf text="^S={URL='#IDX2'}Transposed";
proc print data=sashelp.class;
title 'PRINT';run;
proc standard data=sashelp.class print;
title "STANDARD"; run;
proc transpose data=sashelp.class; run;
proc print;
title "Transposed" ; run;
ods pdf close;
/* Example 2 */
proc template;
define style styles.mystyle; parent=styles.printer;
style UserText from Note "Controls the TEXT= style" /
font_size=15pt
font_weight=bold
just=c
;
end;
run;
ods pdf file="tt.pdf" style=styles.mystyle;
ods escapechar="^";
title "Contents";
ods pdf text="^S={URL='#print'}PROC PRINT";
ods pdf text="^S={URL='#standard'}PROC STANDARD";
ods pdf text="^S={URL='#transposed'}Transposed";
title 'The SAS System';
ods pdf anchor="print";
proc print data=sashelp.class; title "PRINT" ; run;
ods pdf anchor="standard";
proc standard data=sashelp.class print; title "STANDARD"; run;
ods pdf anchor="transposed";
proc transpose data=sashelp.class; run;
proc print; title "Transposed"; run;
ods pdf close;
Operating System and Release Information
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
| Type: | Usage Note |
| Priority: | low |
| Topic: | System Administration ==> Printing Third Party ==> Output ==> PDF SAS Reference ==> ODS (Output Delivery System)
|
| Date Modified: | 2006-01-20 12:04:06 |
| Date Created: | 2004-09-30 12:20:06 |