Data visualization with SAS programming

choosing non-consecutive symbols in gplot

Reply
Occasional Contributor
Posts: 16

choosing non-consecutive symbols in gplot

Hello,
I have a gplot procedure that I want to run with various combinations of variables.
I am using a macro so that I can run these.
The gplot code includes symbol definitions symbol1 - symbol10.
If, for example, I want to plot only 4 of the variables,is there anyway that I can tell the plot to use symbol2, symbol4, symbol6 and symbol8 rather than run through the symbol list consecutively?

Thanks in advance.
SAS Employee
Posts: 980

Re: choosing non-consecutive symbols in gplot

When you say "plot y*x" you can specify which symbol statement to use (plot y*x=#), rather than taking the default.

For example...

symbol1 value=dot color=red;
symbol2 value=square color=blue;

proc gplot data=sashelp.class;
plot height*weight=2;
run;
Occasional Contributor
Posts: 16

Re: choosing non-consecutive symbols in gplot

Thank you Robert,
The problem is that y*x=2 doesn't work with overlays.
The code is something like this:
---------------------------------------------------
%macro m(var haxis vaxis legend);
proc gplot data=match
; symbol1 h=1 v=dot i=join c=blue line=1;
symbol2 h=1 v=star i=join c=red font= line=1;
symbol3 h=1 v=triangle i=join c=blue font= line=1;
symbol4 h=1 v=square i=join c=red line=1;
symbol5 h=1 v=dot i=join c=blue line=1;
plot (&var)*time / haxis=&haxis vaxis=&vaxis legend=&legend skipmiss overlay;;
run;quit;
%mend;

%m(a b c d e,axis1, axis2,legend1);
%m(a c e, axis1, axis2, legend1);

-----------------------------------------------------
Is there a way to assign symbol1, symbol3 and symbol5 (corresponding to a, c and e, to the second macro statement?

Thanks.
SAS Employee
Posts: 980

Re: choosing non-consecutive symbols in gplot

Sure - you can use plot y*x=# with overlays! :-)

Here's a (nonsense) example...

symbol1 value=dot color=red;
symbol2 value=square color=blue;

proc gplot data=sashelp.class;
plot age*weight=1 height*weight=2 / overlay;
run;


But, rather than using "plot (var1 var2)*time, you'll need to construct your plot statement as "plot var1*time=1 plot var2*time=3" and so on...
Occasional Contributor
Posts: 16

Re: choosing non-consecutive symbols in gplot

Brilliant!
Thanks so much for your help and attention.
Ask a Question
Discussion stats
  • 4 replies
  • 236 views
  • 0 likes
  • 2 in conversation