I have summarized data that I want to plot as box and whisker plots. I have added an "outlier" point to certain classes. I would like 2 separate plots, one with outliers and one without.
Here's what I've got:
data test;
input _stat_ $ _label_ $ col1 has_outlier;
datalines;
Max A 2.1837546442 0
Mean A 0 0
Median A 0.0101415946 0
Min A -2.698021137 0
Q1 A -0.656874482 0
Q3 A 0.6635898047 0
Max B 2.2346071965 1
Mean B 0 1
Median B -0.025621533 1
Min B -2.380132327 1
Q1 B -0.658781626 1
Q3 B 0.7248025307 1
Outlier B -2.120639115 1
Max C 1.9904289904 0
Mean C 0 0
Median C 0.0164299847 0
Min C -2.032578831 0
Q1 C -0.454702942 0
Q3 C 0.7259160175 0
;
proc template;
define statgraph boxplotparm1;
begingraph;
layout datapanel classvars=(has_outlier) / columns=2 rowdatarange=union;
layout prototype / cycleattrs=true;
boxplotparm x=_label_ y=col1 stat=_stat_ /
datalabel=datalabel spread=true dataskin=sheen outlierattrs=(color=red symbol=Asterisk);
endlayout;
endlayout;
endgraph;
end;
run;
/* Generate the plot. */
proc sgrender data=test template=boxplotparm1;
run;
I would like to remove the classes from the charts where there is no box plot. So the "No Outlier" group should only show "A" and "C" and the "Outlier" group should only show "B".