To generate a link in PDF, use the same mechanism as that used in HTML; the URL= style attribute or the URL attribute in the CALL DEFINE statement of PROC REPORT.
Like other destinations, the PDF destination automatically generates link names with the following naming convention: IDX-IDXn. The Full Code section shows how to link to other pages within a PDF file that is created by ODS.
Example 2 is the preferred method of linking inside a PDF file. Instead of using the automatic anchor values, the ANCHOR= option specifies #PRINT, #STANDARD, and #TRANSPOSED in the ODS PDF statements. However, if a single procedure (like GLM) produces many tables, then Example 1 is the suggested strategy.
proc template;
define style styles.mystyle;
parent=styles.pearl;
style UserText from Note "Controls the TEXT= style" /
font_size=15pt
font_weight=bold
just=c
;
end;
run;
/* Example 1 */
footnote;
ods _all_ close;
ods pdf file="idx.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";
ods pdf startpage=now;
proc print data=sashelp.class;
title 'PRINT';
/* Use only in SAS 9.4 and higher: */
footnote "^S={URL='idx.pdf#PAGE=1'}return to page 1";
run;
proc standard data=sashelp.class print;
title "STANDARD";
run;
proc transpose data=sashelp.class;
run;
proc print;
title "Transposed" ;
run;
ods pdf close;
footnote;
/* Example 2 */
ods pdf file="anchor.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";
ods pdf startpage=now;
ods pdf anchor="print";
proc print data=sashelp.class; title "PRINT" ;
/* Use only in SAS 9.4 and higher: */
footnote "^S={URL='anchor.pdf#PAGE=1'}return to page 1";
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;