BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
jserafy
Calcite | Level 5

Any help with the code bellow would be appreciated

This code produces a box-plot with blue bars (and symbos) for the first group and red for the second group.

Is there a way to reverse the colors to red for the first group and blue for the second group?

 

proc sgplot data=c;
vbox ar_sav / category=timeblock nofill nooutliers notches
group=seas;
yaxis values=(0 to 2 by .5) label="SAV Cover";
xaxis label="Time period";
run;

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

The graph attributes based on a GROUP variable will typically assign the first element of the style to the first level of group encountered. So sometimes just sorting the data so the "second" group appears first will do.

 

Most of the graphs will also allow a GROUPORDER= option. The default is DATA which is why sorting sometimes works. Options Grouporder=Reversedata would treat group variable in reverse order so would likely work for this case. Grouporder=Ascending or Descending would display in sort order or reverse sort order of the group variable.

 

View solution in original post

3 REPLIES 3
ballardw
Super User

The graph attributes based on a GROUP variable will typically assign the first element of the style to the first level of group encountered. So sometimes just sorting the data so the "second" group appears first will do.

 

Most of the graphs will also allow a GROUPORDER= option. The default is DATA which is why sorting sometimes works. Options Grouporder=Reversedata would treat group variable in reverse order so would likely work for this case. Grouporder=Ascending or Descending would display in sort order or reverse sort order of the group variable.

 

jserafy
Calcite | Level 5

Thanks ballardw - I'll try that.

I found another solution -  addition of this line:    styleattrs datacontrastcolors=(red blue);

Really appreciate the help.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 368 views
  • 0 likes
  • 2 in conversation