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

Hi there!

Wondering if someone can assist me? One of my boxplot groups got switched (center one) and I'm unsure how to correct. 

agille05_0-1654537332677.png

This is my code:

Proc sgplot data=box dattrmap=myattrmap;
vbox age /category=cat group=gender nooutliers attrid=gen;
Where Gender in ("Male", "Female");
Keylegend / location=inside position=bottom;
Xaxis display=(nolabel);
Yaxis values=(2 to 20 by 4) minor display=(nolabel);
Run;

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
JOL
SAS Employee JOL
SAS Employee

On the PROC SGPLOT statement try using the GROUPORDER= option.  Values are  DATA, REVERSEDATA, ASCENDING, DESCENDING

 

JOL_0-1654541158807.png

 

View solution in original post

4 REPLIES 4
Tom
Super User Tom
Super User

What order is the data in BOX?  Does it match the order you want or does it match the order you got?

JOL
SAS Employee JOL
SAS Employee

On the PROC SGPLOT statement try using the GROUPORDER= option.  Values are  DATA, REVERSEDATA, ASCENDING, DESCENDING

 

JOL_0-1654541158807.png

 

agille05
Fluorite | Level 6

That worked! Thank you :). To the printer! 

ballardw
Super User

Try adding the Grouporder=Ascending (or Descending) to the VBOX statement. That should make the order of the group values consistent.

 


@agille05 wrote:

Hi there!

Wondering if someone can assist me? One of my boxplot groups got switched (center one) and I'm unsure how to correct. 

agille05_0-1654537332677.png

This is my code:

Proc sgplot data=box dattrmap=myattrmap;
vbox age /category=cat group=gender nooutliers attrid=gen;
Where Gender in ("Male", "Female");
Keylegend / location=inside position=bottom;
Xaxis display=(nolabel);
Yaxis values=(2 to 20 by 4) minor display=(nolabel);
Run;

Thank you!


 

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 901 views
  • 0 likes
  • 4 in conversation