11-20-2017 05:04 AM - edited 11-20-2017 05:06 AM
What plot are you talking about? Show us some of your code
Or perhaps this article can help you:
11-20-2017 05:21 AM
The simplest way is to set your labels to be numbers in the order you want to see them, and then apply a format to the labels so they show the text, e.g.:
proc format; value temp 1="Value 2" 2="Value 3" 3="Value 1"; run; data have; set have; if lab="Value 2" then labn=1; ...; format labn temp.; run;
Then use labn as your labels, this will sort by the number, and display the test per the format.
11-20-2017 09:27 AM
No probs. You might want to favourite this site:
Its has thousands of examples of all types of graphs using sgplot/gtl. Very useful.
11-21-2017 02:37 AM
thanks for the help, It unfortunately didn't work with your suggestions, I probably might have made a mistake some where in the code but I finally found a very easy way to solve the problem.
the issue is that I wanted to sort the listed items in my keylegend. Not using ascending or descending order as used in Sortorder (the Keylegend Statement).
I solved the problem this way: since I have set the order already in my attrmap while assigning colors to the bars. I just added an extra column to my attrmap which is Show = "Attrmap"
this displays the legend items in the order which is defined in the Attrmap for a example if you assign colors this way using attrmap
input id $ value $10. @19 fillcolor $8. show $10.;
flavor Vanilla beige attrmap
flavor Chocolate cx663D29 attrmap
flavor Strawberry pink attrmap
this will display the items in your legend in this order vanilla, Chocolate, Strawberry
11-27-2017 11:03 AM
Great solution, Anita!
A related tip:
When using the SHOW and NOCASE columns, I usually RETAIN the values for the attrmap, as you can have only one value for these columns per map. Using RETAIN helps simplify the data step a bit:
retain show "attrmap";
input id $ value $10. @19 fillcolor $8.;
flavor Vanilla beige
flavor Chocolate cx663D29
flavor Strawberry pink