Data visualization with SAS programming

Specify Legend Category Order

Regular Contributor
Posts: 247

Specify Legend Category Order

[ Edited ]

I just upgraded from SAS 9.3 to SAS 9.4 last month, and I am trying out a few new features.  One of which is using the LINECOLORGROUP= option in GTL for a spaghetti plot instead of looping through a template and adjusting all the GraphDataN color options.


I'm not sure if this is the issue, but my legends are not showing up in the order that I would like.  The POSNEG variable is coded as 1=Positive, 2=Negative, and 9=Non-Evaluable.  I would like the legend to show up in that order with Positive=blue, Negative=red, and Non-Evaluable=orange.  However, running the attached code, you can see that the legend comes out as Positive=blue, Non-Evaluable=red, and Negative=orange.  I originally thought that the legend was ordering in reverse alphabetical order, but as I looked at the data, it looks like it is coming out in the order in which the category values appear in the data.


Is there an option that I can change, or do I need to attempt some fun code as a workaround?

Ask a Question
Discussion stats
  • 0 replies
  • 1 in conversation