When creating the printable TOC page in PDF, there is a hyperlink in the TOC title.
I tried to update the proc template but it doesn't work.
Is there any way to remove the hyperlink from the TOC title?
Thanks!
My code for creating the PDF file is:
proc template;
define style stlpdfx;
parent=styles.pearl;
class ContentTitle from ContentTitle /
fontweight = bold
color=dark blue
margintop=12pt
pretext='My Customized Title'
;
end;
run;
ods _all_ close;
options pageno=2;
ods pdf file="&outdir./testfile.pdf" style=stlpdfx contents = yes;
proc document name=tfl.file1;
replay;
run;
proc document name=tfl.file2;
replay;
run;
quit;
ods pdf close;
ODS LISTING;
Please show the SAS code for the step that produced the document files (tfl.file1 and tfl.file2). It is most probable that this is the code that inserted the hyperlink.
The code I used is blow:
What does the Hyperlink link to?
What code does your %LONG_FOOT macro produce?
Can you recreate the issue without all of the macro code?
If not the eliminate the macro code by first running with the MPRINT option turned on (or perhaps even the MFILE option) and try running the generated code in a new session.
Now that you have the actual code try making it simpler. Replace your complicate PROC REPORT with something simpler. Perhaps something as simple as :
proc report data=sashelp.class(obs=10);
run;
Do you still get the hyperlink?
The hyperlink in the "Table of Contents" is linked to the first file.
I tried the simple code and the hyperlink still exists.
%let outdir = C:/User/temp;
ods pdf file="&outdir./test.pdf" style=stlpdf contents = yes ;
proc report data=sashelp.class(obs=10);
run;
proc report data=sashelp.class(obs=20);
run;
ods pdf close;
Isn't that the point of a table of contents?
They are not links to external files, they are links to locations with this file where the item listed in the table of contents can be found.
Is there a reason why they cause problems?
Yes, so I am ok with the hyperlink in the contents of TOC (the red part in the screenshot).
I want to remove the hyperlink from the words of "Table on Contents" (the yellow part in the screenshot).
Is there any way to do that?
That does seem stupid. It it linked anywhere it should be the page it is already on.
You try seeing if you can do it with CSS style changes?
If you add the DOM option to your ODS PDF it will print the CSS it is generating to the SAS log.
Looks your might be able to use CSS to change this element??
<p class="contenttitle" url="idx"> </p>
Hi Tom,
I tried the CSS style and it doesn't work.
The hyperlink is still there.
Here is my CSS style:
.body, .systemtitle, .header, .data {
font-family: Courier New;
}
.body {
color: black;
background-color: white;
border: solid black 0.1px;
margin-bottom: 0.77in;
margin-left: 1.34in;
margin-right: 1.34in;
margin-top: 0.77in;
}
.data
{
color: black;
font-family: 'Courier New';
font-size: 9pt;
font-style: normal;
font-weight: normal;
border-width: 0.1em 0 0.1pt 0;
}
.table
{
background-color: #FFFFFF;
border-collapse: collapse;
border-bottom-width: 0.1pt;
border-collapse: separate;
border-color: none;
border-left-width: 0px;
border-right-width: 0px;
border-spacing: 0pt;
border-style: solid;
border-top-width: 0.1pt;
color: black;
font-family: 'Courier New';
font-size: 9pt;
font-style: normal;
font-weight: normal;
text-align: center;
margin-bottom: 0.77in;
margin-left: 1.34in;
margin-right: 1.34in;
margin-top: 0.77in;
}
.header
{
border-collapse: collapse;
border-bottom-width: 0.1pt;
border-collapse: separate;
border-color: none;
border-left-width: 0px;
border-right-width: 0px;
border-spacing: 0pt;
border-style: solid;
border-top-width: 0.1pt;
background-color: #FFFFFF;
color: #000000;
font-family: 'Courier New';
font-size: 9pt;
font-style: normal;
font-weight: normal;
}
.systemtitle
{
color: #000000;
font-family: 'Courier New';
font-size: 9pt;
font-style: normal;
font-weight: normal;
background-color: none;
}
.systemfooter
{
background-color: #FFFFFF;
color: #000000;
font-family: 'Courier New';
font-size: 9pt;
font-style: normal;
font-weight: normal;
}
.contents
{
background-color: #FFFFFF;
color: blue;
font-family: 'Courier New';
font-size: 9pt;
font-style: normal;
font-weight: normal;
list-style-type: decimal;
margin-left: 0px;
margin-right: 0px;
}
.contents
{
list-style-type: square;
pointer-events: none;
}
.contenttitle
{
color: green;
font-family: 'Courier New';
font-size: 12pt;
font-style: normal;
font-weight: bold;
margin-bottom: 4em;
margin-left: 1em;
margin-right: 1em;
margin-top: 4em;
text-align: center;
width: 100%;
background-color:aqua;
pointer-events: none;
}
.contentproclabel
{
color: blue;
font-family: 'Courier New';
font-size: 8pt;
font-style: normal;
font-weight: normal;
list-style-type: decimal;
margin-left: 0in;
margin-right: 0in;
}
.contentitem
{
color: red;
font-family: 'Courier New';
font-size: 9pt;
font-style: normal;
font-weight: normal;
list-style-type: none;
margin-left: 15%;
margin-right: 15%;
}
.contentfolder
{
color: purple;
font-family: 'Courier New';
font-size: 9pt;
font-style: normal;
font-weight: normal;
list-style-type: none;
margin-left: 15%;
margin-right: 15%;
}
.usertext
{
background-color: #FFFFFF;
color: yellow;
font-family: 'Courier New';
font-size: 9pt;
font-style: normal;
font-weight: normal;
pointer-events: none;
}
Here is my SAS code to generate the output:
filename ncss "mypath./testt.css";
proc template;
define style styles.mycssstyle;
import ncss;
end;
define style styles.mycssstyleprinter;
parent=styles.mycssstyle;
import ncss print;
class contenttitle/
pretext = "TAT";
end;
run;
ods pdf file="&outdir./test.pdf" style=styles.mycssstyleprinter contents = yes ;
ods proclabel = "TEST1";
title "test1";
proc report data=sashelp.class(obs=10);
run;
ods proclabel = "TEST2";
title "test2";
proc report data=sashelp.class(obs=20);
run;
ods _all_ close;
ods pdf file="&outdir./test.pdf" style=styles.mycssstyleprinter contents = yes ;
ods proclabel = "TEST1";
title "test1";
proc report data=sashelp.class(obs=10);
run;
ods proclabel = "TEST2";
title "test2";
proc report data=sashelp.class(obs=20);
run;
ods _all_ close;
I have tried the code you posted. It doesn't work either.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.