BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Muandre
Obsidian | Level 7

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 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

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.

View solution in original post

4 REPLIES 4
Rick_SAS
SAS Super FREQ

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

;

 

 

Muandre
Obsidian | Level 7

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;

 

 

Rick_SAS
SAS Super FREQ

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.

Muandre
Obsidian | Level 7

" 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!

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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