Dear SAS community, I would like to use "pattern" option in "Band" statement, but the code does not work.
Referring to the instruction under
I use FILLPATTERN and FILLPATTERNATTRS=(pattern=R1) in "band" statement. it does not work. Thank you as always!
proc sgplot data=Density;
series x=height ;
band x=height upper=upside lower=lowside / fillattrs=(color=red transparency=0.7) FILLPATTERN FILLPATTERNATTRS=(pattern=R1) legendlabel="Lower Decile";
run;
Hello,
The fillpattern option was introduced with SAS 9.4 M5, you can read more about that here: https://documentation.sas.com/?docsetId=grstatproc&docsetTarget=grstatprocwhatsnew94.htm&docsetVersi...
You should consider upgrading...
greetings,
Mathias.
Hello,
The series statement needs both an x= and a y= argument. You can omit the "series" statement and only have a "band" when you don't have a variable to plot and only want the bands to be visible.
running this example would generate some data and a plot including a pattern in the band as expected:
data want; value=INT(ranuni(765)*100); _up=value*.1; _low=_up; do x=1 to 100; value=value+(10-CEIL(20*ranuni(203))); up=value+_up; low=value-_low; _up=_up+(4-CEIL(5*ranuni(203))); _low=_low+(4-CEIL(5*ranuni(203))); output; end; drop _:; run; proc sgplot data=want; series x=x y=value; band x=x upper=up lower=low / fillattrs=(color=red transparency=0.7) FILLPATTERN FILLPATTERNATTRS=(pattern=R3) legendlabel="Lower Decile"; run;
and this is the output generated.
All the best,
Mathias.
Mathias, really appreciate your help! I tried the code, and the same error is still there:
then I use "fill" rather than "fillpattern", the error is as following:
is the error SAS version specific?
Hello,
The fillpattern option was introduced with SAS 9.4 M5, you can read more about that here: https://documentation.sas.com/?docsetId=grstatproc&docsetTarget=grstatprocwhatsnew94.htm&docsetVersi...
You should consider upgrading...
greetings,
Mathias.
thanks again, will make my supervisor aware.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.