BookmarkSubscribeRSS Feed
natanya
Calcite | Level 5
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.
4 REPLIES 4
GraphGuy
Meteorite | Level 14
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;
natanya
Calcite | Level 5
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.
GraphGuy
Meteorite | Level 14
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...
natanya
Calcite | Level 5
Brilliant!
Thanks so much for your help and attention.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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