I'm sure this has been answered before but I'm not even sure what to search on. When you have a graph displaying multiple lines (say sales by month and year, with the months along the x axis and each line on the graph representing a year), how do you control which line is 'on top'?
It would be nice to see the most recent year on the top if the data is close from one year to the next.
The graph in question uses spline smoothing in a set of SYMBOLn statements with different symbols (star, triangle, etc.) to represent the data points. Currently some 2012 month points are buried by prior year points. These are displayed as html graphs so hovering over the month in question returns the prior year value.
It has been awhile since I played with this but I think it has to do with the order the SYMBOL statements are associated with values. Have you tried sorting the data by year (or Z in general). Or sometines sort by the FORMATTED value of Z.
IIRC if my first data point were associated with 2012 then it gets the Symbol1 statment and if the next record is 2010 it gets Symbol2. Then SAS displays them in symbol order.
Typically, when I want to make sure a certain line is "in front" of the others, I re-arrange my data so that instead of using "plot y*x=z" I can use "plot y1*x=symbol-num y2*x=symbol-num y3*x=symbol-num". And the lines are drawn in the order specified (the last one is drawn last, and is "in front").
Here's an example with exaggerated/thick lines to demonstrate (note that the symbol2 red line is on top):
symbol1 value=none interpol=join width=7 color=blue;
symbol2 value=none interpol=join width=7 color=red;
symbol3 value=none interpol=join width=7 color=pink;
proc gplot data=sashelp.stocks (where=(stock='IBM'));
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.