BookmarkSubscribeRSS Feed
amm8
Calcite | Level 5
I'm trying to draw href lines on a set of plots. The code I'm using for the plots is:

proc gplot data=rays;
plot y*x = rad /haxis=axis1;
by name;
run;

This makes a plot for each name.

I would like to add href lines for each plot. The location of the href line is unique for each name. The locations are values in the dataset rays. Is there an easy way to do this?

Thanks,

Ashy
2 REPLIES 2
DanH_sas
SAS Super FREQ
Hey Ashy,

If you are running SAS 9.2, you can do this easily with PROC SGPLOT. This procedure supports variables on the REFLINE statement. Here is an example using your variables:

[pre]
proc sgplot data=rays;
refline ref_value_column;
scatter x=x y=y / group=rad;
run;
[/pre]

Let me know if you have any other questions about this.

Thanks!
Dan
deleted_user
Not applicable
Hi Ashy,

You can mention the href option in ur plot statement.

proc gplot data=rays;
plot y*x = rad /haxis=axis1 href='href-value;
by name;
run;

But if you want to save the trouble of writing it for each name, then you can use a macro like following:

%macro macro-name(href,name);

proc gplot data=rays;
plot y*x = rad /haxis=axis1 href=&href;
by &name;
run;

%mend;
%macro-name(href1,name1);
%macro-name(href2,name2);
And so on…

But if you want the values to come out directly from the rays datasheet. Then you can use the symput function.

Hope this helps!

Let me know if you have anymore question on this Message was edited by: neophyte

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

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
  • 2 replies
  • 3777 views
  • 0 likes
  • 3 in conversation