BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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;
5 REPLIES 5
GraphGuy
Meteorite | Level 14
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;
deleted_user
Not applicable
Ah the color!

I was not interested in controlling the color so I left it out. Now my chart works
GraphGuy
Meteorite | Level 14
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 🙂
DanH_sas
SAS Super FREQ
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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 5 replies
  • 847 views
  • 0 likes
  • 3 in conversation