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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 811 views
  • 0 likes
  • 2 in conversation