BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
josuerodrigues
Calcite | Level 5

Hello everyone,
I'm creating a bar graph using PROC SGPLOT with three biochar fractions and four application doses. The graph is almost exactly how I want it, but I'm trying to apply different fill patterns to each bar group.

From the VBARPARM STATEMENT, the fillpatternattrs (or datafillpatterns) option should allow this, but I couldn't get it to work as expected. I would like to assign the patterns "L1, X1, and R1" to the three fractions for clearer visual distinction.

Has anyone successfully done this in SAS OnDemand for Academics or have any suggestions?

Thanks in advance!

 

ods graphics / width=800px height=600px attrpriority=none;
proc sgplot data=medias2;
styleattrs datacolors=(bgr blb dagry) datafillpatterns=(R1 L1 X1);
vbarparm category=dose
response=mean_pH / group=Fração2
groupdisplay=cluster
fillattrs=(transparency=0)
outlineattrs=(thickness=0 color=black)
name="barras";
yaxis label="Soil pH"
labelattrs=(family="Times New Roman" size=12 weight=bold)
valueattrs=(family="Times New Roman" size=12)
max=7;
xaxis label="Dose de biochar"
labelattrs=(family="Times New Roman" size=12 weight=bold)
valueattrs=(family="Times New Roman" size=12);
keylegend "barras" /
location=outside
position=right
titleattrs=(color=black family="Times New Roman" size=12)
valueattrs=(color=black family="Times New Roman" size=12)
noborder;
run;

 

josuerodrigues_0-1750277133284.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
ods graphics / width=800px height=600px attrpriority=none;
proc sgplot data=sashelp.heart;
styleattrs datacolors=(bgr blb dagry) datacontrastcolors=(white) datafillpatterns=(R1 L1 X1);
vbarparm category=smoking_status
response=height / group=bp_status
groupdisplay=cluster
fillattrs=(transparency=0)
outlineattrs=(thickness=0 color=black)
fillpattern
;
run;

Ksharp_0-1750295724951.png

 

View solution in original post

2 REPLIES 2
antonbcristina
SAS Super FREQ

Hi @josuerodrigues, you'll want to add a fillpattern option to your vbarparm statement to enable the fill patterns selected, like so:

 

 

...

vbarparm category=dose response=mean_pH / group=Fração2 groupdisplay=cluster fillattrs=(transparency=0) outlineattrs=(thickness=0 color=black) name="barras" fillpattern;

...
Ksharp
Super User
ods graphics / width=800px height=600px attrpriority=none;
proc sgplot data=sashelp.heart;
styleattrs datacolors=(bgr blb dagry) datacontrastcolors=(white) datafillpatterns=(R1 L1 X1);
vbarparm category=smoking_status
response=height / group=bp_status
groupdisplay=cluster
fillattrs=(transparency=0)
outlineattrs=(thickness=0 color=black)
fillpattern
;
run;

Ksharp_0-1750295724951.png

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 847 views
  • 0 likes
  • 3 in conversation