10-18-2013 02:32 PM
Hi Experts, I copied the below example from SAS/GRAPG 9.3 reference. Why “Click a bar for details” does not work in file ‘salesrpt_single_page.pdf’ (not through SAS) ?
/* Example: Writing a Drill-Down Graph to a PDF File */
/* Define the PDF output filename. */
filename outp "salesrpt_single_page.pdf";
/* Define the ODS output path. */
filename odsout ".";
/* Define the base URL for the links. */
/* Create the data set REGSALES. */
length Region State $ 8 Location $ 15;
format Sales dollar8.;
input State Region Location Sales;
IL Central EVANSTON 18038
IL Central CHICAGO 14322
IL Central AURORA 10768
OH Central COLUMBUS 13611
OH Central DAYTON 11084
OH Central CINCINNATI 19534
FL South MIAMI 14541
FL South TAMPA 16733
NC South RALEIGH 19022
NC South WILMINGTON 12876
NC South CHARLOTTE 13498
CA West SANTA-CRUZ 13636
CA West LONG-BEACH 15687
WA West SEATTLE 18988
WA West TACOMA 14523
/* Add the link information to the data. */
length RPTR $ 80;
if (Region="Central") then RPTR="&baseurl./Central.htm";
else if (Region="South") then RPTR="&baseurl./South.htm";
else if (Region="West") then RPTR="&baseurl./West.htm";
/* Close the HTML destination and set the graphics options. */
ods html close;
goptions reset=all device=png border xpixels=520 ypixels=450;
/* Clear titles and footnotes */
/* Create a macro to use for generating the region charts. */
/* Open ODS HTML destination. Use the region name as the filename */
ods html file="®ion..htm" path=odsout style=listing;
/* Set the axis label and title */
axis1 label=("Total Sales");
title1 "Total Sales in ®ion Region";
/* Create the chart */
proc gchart data=regsales;
vbar3d state / sumvar=sales outside=sum name="region"
description="Total sales for ®ion region"
/* Close the ODS HTML destination */
ods html close;
/* Call the %DO_REGION macro for Central, South, and West. */
/* Open the PDF destination and set the style. */
ods pdf style=statistical;
/* Set the graphics options. You must use the PDF or PDFA device. */
goptions reset=all gsfname=outp device=pdf border
vorigin=2.5in horigin=0.6in vsize=550pt hsize=520pt;
/* Generate the Company Sales report PDF document. */
title1 "Company Sales Report";
title2 "Sales by Region";
footnote1 "(Click a bar for details.)";
axis1 label=("Total Sales") reflabel=(j=r "Target ");
proc gchart data=regsales;
vbar3d region /
cref=red lref=3 ref=62000 /* Draw a reference line at the */
/* sales target. */
sumvar=sales outside=sum raxis=axis1
shape=cylinder width=15 patternid=midpoint
description="Company sales report"
url=RPTR; /* Specify RPT as the URL variable in the data. */
/* Close the PDF destination and open HTML */
ods pdf close;
/* Reset graphics options, titles, and footnotes */
10-18-2013 03:11 PM
The output file created was called sasprt (just ran the code above) which seems a bit weird but the links work fine. My only issue was I did get a warning in my browser about links activex content being blocked, so your browser settings could be something to look into.
EDIT: The report you mention does exist, just not the first one I saw. The links in that one DO NOT work. The links in the other one do...
10-18-2013 03:21 PM
Do you need to modify the code if you are going to email the PDF file to someone who doesn’t have sas? Are the links still clickable?
10-18-2013 03:26 PM
The links are to pages outside the document, separate html/png files, which would need to be emailed as well.
A person with SAS can open the file, but personally, I wouldn't go down this route because its difficult to package and help people when something is broken.
10-18-2013 03:28 PM
Here is some pdf output from one of my SAS jobs, with drilldowns, if you want to try viewing that:
And here is the SAS code I used, in case that might help:
10-18-2013 03:25 PM
Which version of SAS are you using?
(drilldown in pdf is a fairly new feature - I believe it's only available in SAS 9.3 and higher)
And how are you viewing the pdf?
(for example, I'm viewing it in the IE browser, on a Windows computer)
10-18-2013 03:39 PM
With my pdf, when I double-click the pdf in Windows Explorer, it comes up in Adobe Reader (is that what your PC is configured to use? - this could vary from PC to PC), and when I click the bars there the drilldowns work - it asks me if I want to allow or block, and when I allow, it pops up an IE browser window with the drilldown page (IE is my default web browser, but this could also be different on your PC).
When I view the pdf in IE (such as the url/link I posted a few minutes ago), then when I click the bars it goes to the drilldown url directly in that IE browser.
10-21-2013 09:13 AM