Data visualization with SAS programming

what gives, trying to plot different symbols on different lines

Reply
N/A
Posts: 0

what gives, trying to plot different symbols on different lines

I have the following program. I have 5 different values for CD. Each one has a value for each month. I want to connect the points with a line and plot a different symbol for each line. However, it is not working. What gives?

axis2 label=('Month and Year') value=(h=8pt a=90);

ods rtf body="chart.rtf" ;
symbol1 interpol=j v=triangle;;
symbol2 interpol=j v=circle;
symbol3 interpol=j v=square;
symbol4 interpol=j v=diamond;
symbol5 interpol=j v=dot;

proc sort data=bill; by CD date;
proc gplot data=bill;
plot n*date=CD/ haxis=axis2;
run;quit;

ods listing close;
ods rtf close;

run;
run;quit;
SAS Employee
Posts: 980

Re: what gives, trying to plot different symbols on different lines

Without the data to try it out, I'm just going on a "hunch" here, but ...

I think when you use y*x=cd it will only connect the markers that have the same value of CD.

But you can "trick" it into looking like they are connected, by first doing a plot of just the line, and then doing a plot of the different markers, and overlay them. Something like the following (not 100% sure this code will work ver-batim, since I don't have the data)...

ps - I'm assuming you don't really want to plot "by cd date", because that would produce a separate plot for each cd and each date (that's not what you want, right?)


symbol1 interpol=none v=triangle c=red;
symbol2 interpol=none v=circle c=green;
symbol3 interpol=none v=square c=pink;
symbol4 interpol=none v=diamond c=purple;
symbol5 interpol=none v=dot c=tan;
symbol6 interpol=j v=none c=black;

proc gplot data=bill;
plot n*date=6 n*date=CD/ overlay haxis=axis2;
run;quit;
N/A
Posts: 0

Re: what gives, trying to plot different symbols on different lines

Ah the color!

I was not interested in controlling the color so I left it out. Now my chart works
SAS Employee
Posts: 980

Re: what gives, trying to plot different symbols on different lines

Yes, you'll (almost) _always_ want to specify a color in your symbol statements. If you don't, then I believe it cycles through all the colors in your color list for each symbol, before it starts using the next symbol (... or something like that).

I'm not 100% sure, because I always specify a color :-)
SAS Super FREQ
Posts: 925

Re: what gives, trying to plot different symbols on different lines

Here's a tip if you are using SAS 9.2:

As Robert said, you need to specify a color to make the graph procedure move to the next global statement; however, you may just want to use a color from the ODS style instead of picking a custom color. You can do this by specifying the color as _style_

symbol i=join color=_style_;

Thanks!
Dan
N/A
Posts: 0

Re: what gives, trying to plot different symbols on different lines

sorry still running 9.1.
Ask a Question
Discussion stats
  • 5 replies
  • 165 views
  • 0 likes
  • 3 in conversation