BookmarkSubscribeRSS Feed
SAS_Muggle
Fluorite | Level 6

I am running a paneled and grouped boxplot and want to summarize the mean and standard deviation as a xaxis table below the plot. I have the below code currently:

 

proc sgpanel data=data;
panelby panel/ layout=columnlattice onepanel uniscale=row novarname;
vbox var/ category=location group=type nooutliers notches ;
rowaxis values=(0 to 18 by 2) grid;
colaxis display=(nolabel);
colaxistable meanvar/ label="Mean" stat=median class=type classdisplay=cluster valueattrs=(size=5) ;
keylegend / title="";
run;

 

Basically, when I try to run the colaxistable with var as the variable and stat=mean, it is putting too many decimals, so instead I created a separate table  with the mean and standard deviation (the standard deviation option is not available for colaxistable anyway) for each location, type group and merged it back in to the original data. Since I have multiple observations for var for each panel-location-type, I think it is giving me a sum in the graph, so I put stat=median as a workaround to give me the actual value I calculated but its still summing them. The other issue is the group variable, I want the value to be under the boxplot for the correct panel-category-group and it wasnt doing that, so I put the group variable as the colaxistable class and groupdisplay=cluster, but the order is wrong. Anyone have any tips or workaround?

2 REPLIES 2
himself
Pyrite | Level 9
Hi do you mind sharing a shell of what you anticipate to achieve , I think this might be easier
ballardw
Super User

Hint: without actual values and a stated specified order there is no way anyone can address your "order is wrong" issue. Even without the graph or colaxistable. We couldn't solve it if the issue was Proc Sort or anything else.

 

Best is to provide some data that the code will work with in the form of a working data step. Really.

Then state explicitly what order the offending values are supposed to have.

 

And by any chance is your LOG showing this warning:

WARNING: The AXISTABLE supports only SUM and MEAN statistics when a bar chart, line chart, or dot
         plot is not used. The SUM statistic will be used by default.

 

And what is the FORMAT assigned to the VBOX variable? Compare the output of these two graphs. You should be able to run this as SASHELP.PRDSALE is one of the training sets included with SAS.

proc sgpanel data=sashelp.prdsale;
panelby country/ layout=columnlattice onepanel uniscale=row novarname;
vbox actual/ category=region group=division nooutliers notches ;
/*rowaxis values=(0 to 18 by 2) grid;*/
colaxis display=(nolabel);
colaxistable actual/ label="Mean" stat=mean 
    class=division classdisplay=cluster 
/*    valueattrs=(size=5) */
;
format actual best7.;
keylegend / title="";
run;
proc sgpanel data=sashelp.prdsale;
panelby country/ layout=columnlattice onepanel uniscale=row novarname;
vbox actual/ category=region group=division nooutliers notches ;
/*rowaxis values=(0 to 18 by 2) grid;*/
colaxis display=(nolabel);
colaxistable actual/ label="Mean" stat=mean 
    class=division classdisplay=cluster 
/*    valueattrs=(size=5) */
;
format actual f5.1;
keylegend / title="";
run;

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
  • 2 replies
  • 156 views
  • 0 likes
  • 3 in conversation