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

Consider this sample

 

data plotdata(keep=group id subgroup metric);
  do group = 'A', 'B';
    do subgroup = 2, 4, 6, 8;
      do _n_ = 1 to 15;
        id = (group='B') * 100 + _n_;
        metric = rand('integer', 25, 50);
        output;
      end;      
    end;
  end;
run;

proc sgpanel data=plotdata;
  panelby group;
  vbox metric / group = subgroup;
  colaxis label='Subgroup' grid;
run;

ods html close;

RichardADeVenezia_0-1661954595022.png

What is wanted is a plot showing the same boxes, but each group panel showing a colaxis with the subgroup values (2,4,6,8) as tic marks and the boxes above the marks.

 

I would turn off the legend with SGPANEL option NOAUTOLEGEND

 

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

After adding the CATEGORY option, you might also want to add the NOAUTOLEGEND option to the SGPANEL procedure statement. That way, the legend is suppressed. It does not add anything to the graph once you display the tick marks.

proc sgpanel data=plotdata noautolegend;
  panelby group;
  vbox metric / group = subgroup category = subgroup;
  colaxis label='Subgroup' grid;
run;

View solution in original post

2 REPLIES 2
DanH_sas
SAS Super FREQ

Just add CATEGORY=subgroup to your VBOX statement:

vbox metric / group = subgroup category = subgroup;
DanH_sas
SAS Super FREQ

After adding the CATEGORY option, you might also want to add the NOAUTOLEGEND option to the SGPANEL procedure statement. That way, the legend is suppressed. It does not add anything to the graph once you display the tick marks.

proc sgpanel data=plotdata noautolegend;
  panelby group;
  vbox metric / group = subgroup category = subgroup;
  colaxis label='Subgroup' grid;
run;

sas-innovate-2024.png

📢

ANNOUNCEMENT

The early bird rate has been extended! Register by March 18 for just $695 - $100 off the standard rate.

 

Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 

 

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
  • 2 replies
  • 366 views
  • 1 like
  • 2 in conversation