05-15-2012 01:21 PM
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.
05-15-2012 06:37 PM
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.
05-16-2012 10:53 AM
Thanks for taking a stab at it. I have tried re-ordering the data and the Symbol(n) statements with no change in the graph. May need to open a ticket with the Graph folks.
05-16-2012 10:49 AM
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'));