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

Dear SAS community, I would like to use "pattern" option in "Band" statement, but the code does not work.

 

Referring to the instruction under 

https://documentation.sas.com/?docsetId=grstatproc&docsetTarget=n1t2ihc734azuvn17021ri2cl057.htm&doc...

 

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;

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
MCoopmans
SAS Employee

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.

View solution in original post

4 REPLIES 4
MCoopmans
SAS Employee

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.

 

sgplot.png

 

All the best,

Mathias.

 

 

JacAder
Obsidian | Level 7

Mathias, really appreciate your help!  I tried the code, and the same error is still there:

JacAder_0-1595027859484.png

JacAder_1-1595027985138.png

 

then I use "fill" rather than "fillpattern", the error is as following:

JacAder_0-1595028180763.png

 

is the error SAS version specific? 

 

MCoopmans
SAS Employee

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.

JacAder
Obsidian | Level 7

thanks again, will make my supervisor aware.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 1227 views
  • 0 likes
  • 2 in conversation