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!


 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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