- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to tweak the code from here: https://support.sas.com/kb/56/520.html to match my data. However, I have ran into some unexpected issues.
- Median (Min-Max) and Mean(STD) are not showing up in the colaxis table. Is this because they are stored as character? Do the values have to be numeric?
- Not all the box plots are centered. Is there a way to fix this?
- Not really an issue, but is there a way to have "BMI category" on top of the graph rather than the bottom?
Thank you in advance!
Data:
Code & Output:
ods graphics / reset width = 750px height = 460px noscale attrpriority = none;
proc sgpanel data = workstats;
panelby BMIGRP / novarname columns = 3;
vbox ADJDV / category = BMIGRP;
colaxis display = (noticks novalues);
colaxistable _CNT_ / label = 'N' position = bottom separator
valueattrs = (size=10) labelattrs = (size=10);
colaxistable MEAN_STD / label = 'Mean(sd)' position = bottom
valueattrs = (size=10) labelattrs = (size=10);
colaxistable MED_RANGE / label = 'Median(Min - Max)' position = bottom
valueattrs = (size=10) labelattrs = (size=10);
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The character values still don't show. Do they have to be numeric to show in the table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@mariko5797 wrote:
I am trying to tweak the code from here: https://support.sas.com/kb/56/520.html to match my data. However, I have ran into some unexpected issues.
- Median (Min-Max) and Mean(STD) are not showing up in the colaxis table. Is this because they are stored as character? Do the values have to be numeric?
- Not all the box plots are centered. Is there a way to fix this?
- Not really an issue, but is there a way to have "BMI category" on top of the graph rather than the bottom?
1) You might try an INSET statement.
2) Centered which way? All of the elements on a single row have the same Y-axis definition. If you want things vertically centered you will need to place them on different rows and not use the same scale for each row (the default) and then hope the results are "centered". Differing ranges of outliers means that is almost never going to happen.
If you want things centered horizontally then the X axis value would have to be the same for each box if it is numeric.
If you remove the NOVALUES on the Colaxis statement you will see the offsets are caused by the values of the BMIGRP variable.
Below is an example of adding a variable to create a horizontally centered boxes.
proc sgpanel data = sashelp.class; panelby sex / novarname ; vbox age / category = sex; colaxis ; run; data alt; set sashelp.class; dummy=1; run; proc sgpanel data = alt; panelby sex / novarname ; vbox age / category = dummy; colaxis ; run;
3) I don't find an option to move the label to the top. You could suppress the text and use a annotate data set to add text above the graph.