3

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?

Joe
  • 62,789
  • 6
  • 49
  • 67
  • Define "it doesn't work" for the second one. Doesn't work how? what happens when you click on it? – Joe Sep 20 '13 at 19:44
  • What version of SAS? The first method works fine for me (9.3). That's the one I'd recommend. The second method, it attempts to fix your link to a standard link format, which doesn't really work properly; you could fix it yourself (file:\\it4\Project_Data\Daily_Detail.xlsx) perhaps but the former is the 'better' solution. – Joe Sep 20 '13 at 20:01
  • I am using 9.4 but I just tried 9.3 and got the same result. The text in the title2 statement just being printed out. Could it be a setting, an environment issue or even adobe reader? Everything that I have read tells me this should work. – Robert Stevens Sep 20 '13 at 20:09
  • See if you can run the example I posted in an answer (It's not really an answer but there's no good way to post that otherwise). – Joe Sep 20 '13 at 20:12
  • Your code works perfectly. I can even put my filepath in your code and it gives me the link I want. If I comment out all of my GPLOT statements an add your PROC PRINT it works fine in my code. It appears to not want to work with the GPLOT statements. – Robert Stevens Sep 20 '13 at 20:25
  • Hmm. I think GPLOT may be taking over the titles. You might be able to get it to work with the IMAGEMAP option and then some combination of GPLOT options. – Joe Sep 20 '13 at 20:34
  • Appended to my answer a possible solution. – Joe Sep 20 '13 at 20:43
  • The NOGTITLE option didn't change anything. The title is printing above the image, it is just printing out as text and not a link. I will look at the IMAGEMAP option next. – Robert Stevens Sep 20 '13 at 20:50

2 Answers2

1

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.

Joe
  • 62,789
  • 6
  • 49
  • 67
1

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.