Robert Stevens
Robert Stevens

Reputation: 43

SAS ODS PDF Insert Link

I am trying to do something that I think would be simple. I want to insert a link to an xls workbook into a title on a chart generated in GPLOT and output through ODS as a PDF.

I have tried:

ods escapechar="^";
TITLE2 '^S={URL="\\it4\Project_Data\Daily_Detail.xlsx"} To go to the source data Click Here';

This simply displayed the text.

I then tried:

title2 link="\\it4\Project_Data\Daily_Detail.xlsx" "Click here to view table";

With this I get a link but it doesn't work. It is recognized as a link in the PDF. I can hover over it and see the address but the address is showing up as"file:///it4/Project_Data/\Daily_Detail.xlsx", When clicking on it nothing comes up.

What am I missing?

Upvotes: 3

Views: 2259

Answers (2)

Robert Stevens
Robert Stevens

Reputation: 43

Previously I had:

ods escapechar="^";
TITLE 'Daily Report';
TITLE2 '^S={URL="\\it4\Project_Data\Daily_Detail.xlsx"} For source data Click Here';
options orientation=landscape;
axis1 order=(&mindate to &maxdate by week)
  offset=(3,3)
  label=none
  major=(height=1 width=1)
  minor=(number=6 height=.5 width=1)
  width=1;
PROC GPLOT DATA = Letters_Summary;
BY Category;
PLOT Number_Sent*date_sent=Category / haxis = axis1;
symbol interpol=join l=1 w=3;
WHERE category NE "Miscellaneous"
    AND category NE "Verification";
RUN;

This didn't work. It appears that the label and label2 statements needed to be immediately before the GPLOT. Now I have:

options orientation=landscape;
axis1 order=(&mindate to &maxdate by week)
  offset=(3,3)
  label=none
  major=(height=1 width=1)
  minor=(number=6 height=.5 width=1)
  width=1;
ods escapechar="^";
TITLE 'Daily Report';
TITLE2 '^S={URL="\\it4\Project_Data\Daily_Detail.xlsx"} For source data Click Here';
PROC GPLOT DATA = Letters_Summary;
BY Category;
PLOT Number_Sent*date_sent=Category / haxis = axis1;
symbol interpol=join l=1 w=3;
WHERE category NE "Miscellaneous"
    AND category NE "Verification";
RUN;

Now it works. I am not sure why the options or axis statements would interfere with making the title a link.

Upvotes: 1

Joe
Joe

Reputation: 63424

This works on my machine:

ods pdf file="c:\temp\test.pdf";
   ods escapechar="^";
 title "^S={URL='c:\'}PROC PRINT";
 proc print data=sashelp.class;
 run;
 ods pdf close;

I get a PDF that has a blue box around the title, and if I click on the title I get asked if I want to open c:\ .

To use this in GPLOT, you may want to set NOGTITLE to get the title to not appear within the image:

ods pdf file="filename.pdf" nogtitle;

That should cause them to appear as text and then should work similarly.

Upvotes: 1

Related Questions