Hey,
I want to use FILLPATTERN in my boxplot, but I do not find the right syntax, I do not know how to use fillpattern or fillpatternattrs in proc template.
proc template;
define statgraph ohne_bahnen_abschlackbandV1;
dynamic _varY _varX _bygr;
begingraph
;
layout lattice / rowdatarange=data columndatarange=data;
layout overlay / xaxisopts=( griddisplay=off discreteopts=( tickvaluefitpolicy=splitrotate))
;
boxplot x=_varX
y=_varY
/ group=_bygr
name='box' boxwidth=0.85 display=(CAPS FILL MEDIAN outliers)
groupdisplay=Cluster clusterwidth=0.85 grouporder=ascending
;
endlayout;
sidebar / align=bottom spacefill=false;
discretelegend 'box' / opaque=true border=true halign=center valign=center displayclipped=true order=rowmajor;
endsidebar;
endlayout;
endgraph;
end;
run;
proc sgrender data=sashelp.class template=ohne_bahnen_abschlackbandV1;
dynamic _varY="weight" _bygr="sex" _varX="age";
run;
Thanks for your help!
1. Always post the portion of the log that contains the error.
2. Your code is correct and works at SAS 9.4M5.
3. As stated in the documentation, PATTERNATTRS= and DISPLAY=(FILLPATTERN) are 9.4M5 features. If you are running an earlier version of SAS, these options are not available.
You need to specify FILLPATTERN in the DISPLAY=(...) list. If you want a pattern that is different from the default, use the FILLPATTERNATTRS= option. For example, try this:
boxplot x=_varX y=_varY
/ group=_bygr fillpatternattrs=(pattern=L1)
name='box' boxwidth=0.85 display=(CAPS FILL FILLPATTERN MEDIAN outliers)
groupdisplay=Cluster clusterwidth=0.85 grouporder=ascending
;
Thanks for your answer, but my code doesen't work, there is a syntax error:
proc template;
define statgraph TEST1;
dynamic _varY _varX _bygr;
begingraph
;
layout lattice / rowdatarange=data columndatarange=data;
layout overlay / xaxisopts=( griddisplay=off discreteopts=( tickvaluefitpolicy=splitrotate))
;
boxplot x=_varX y=_varY
/ group=_bygr fillpatternattrs=(pattern=L1)
name='box' boxwidth=0.85 display=(CAPS FILL FILLPATTERN MEDIAN outliers)
groupdisplay=Cluster clusterwidth=0.85 grouporder=ascending
;
endlayout;
sidebar / align=bottom spacefill=false;
discretelegend 'box' / opaque=true border=true halign=center valign=center displayclipped=true order=rowmajor;
endsidebar;
endlayout;
endgraph;
end;
run;
proc sgrender data=sashelp.class template=TEST1;
dynamic _varY="weight" _bygr="sex" _varX="age";
run;
1. Always post the portion of the log that contains the error.
2. Your code is correct and works at SAS 9.4M5.
3. As stated in the documentation, PATTERNATTRS= and DISPLAY=(FILLPATTERN) are 9.4M5 features. If you are running an earlier version of SAS, these options are not available.
" If you are running an earlier version of SAS, these options are not available." - My Version of SAS is 9.4_M4, thanks for your help!
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.