BookmarkSubscribeRSS Feed
SachinRuk
Calcite | Level 5
Hi All,

I want to be able to click on a line on a graph and (for arguments sake) go to google.com or yahoo.com. I've attached a link to Robert Allison's code. My question is how do I do the same for a line graph (So far im using Gplot). He's using a Proc Gchart.

Thanks,
Sachin

http://robslink.com/SAS/democd23/overlib.htm
http://robslink.com/SAS/democd23/overlib_info.htm
5 REPLIES 5
GraphGuy
Meteorite | Level 14
In general, with SAS/GRAPH gplot, you can't have drilldowns on the line segment (interpolation between the markers).

You can add drilldowns to the markers, using the same technique as for bar charts (one caveat is that you have to show markers on your line to do that).

You can get a bit "clever", making the markers the same color as the background, and/or annotating 'invisible' areas with drilldowns (corresponding to the lines), etc - but i usually find that showing markers on the lines, and adding drilldowns to those markers, is the best way to go.
SachinRuk
Calcite | Level 5
Hi Robert,

I know this seems like a stupid question but, how do you add markers. Im new to SAS.

Thank you for your patience,
Sachin
DanH_sas
SAS Super FREQ
If you have SAS 9.2, you can use a VLINE (summarized) or SERIES (continuous) line plot that will give you drilldown ability across the whole line. Here is a simple example:

[pre]
data test;
set sashelp.class;
if (sex='F') then url="http://www.google.com";
else url="http://www.bing.com";
run;

ods graphics / imagemap=on;
ods listing close;
ods html;
proc sgplot data=test;
vline age / response=height stat=mean group=sex url=url lineattrs=(pattern=solid thickness=2);
run;
ods html close;
[/pre]
SachinRuk
Calcite | Level 5
sorry dan,

only have 9.1.3 :(... so back to the markers story.

sachin
GraphGuy
Meteorite | Level 14
Ok - back to a good-old gplot line plot ... with markers! 🙂

Here is an example of a gplot scatter plot - the 'markers' are the dots:

http://robslink.com/SAS/democd23/scat.htm
http://robslink.com/SAS/democd23/scat_info.htm

The shape of the markers is specified in the 'symbol' statement:

symbol1 v=dot height=8 color=cx43a2ca;

If you want lines drawn between the dots, you can add the i= (interpolation) option...

symbol1 v=dot height=8 i=join color=cx43a2ca;

One other tip - you'll want to make sure your data is sorted in the order you want the dots connected.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1628 views
  • 0 likes
  • 3 in conversation