Data visualization with SAS programming

proc gplot and href

Reply
Occasional Contributor
Posts: 7

proc gplot and href

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
SAS Super FREQ
Posts: 864

Re: proc gplot and href

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
N/A
Posts: 0

Re: proc gplot and href

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
Post a Question
Discussion Stats
  • 2 replies
  • 425 views
  • 0 likes
  • 3 in conversation