BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
bian123
Calcite | Level 5
data test;
   input x $ y grp $;
   datalines;
1 5 A
1 8 B
2 6 A
2 9 B
;
run;

proc sort data = test;
	by x grp y;
run;


ods path(prepend) work.templat(update);



proc template;
  define statgraph testtemp;


	/* Begin the graph template */
	begingraph / border = false designwidth = 800px designheight = 400px;


	  /* Start the graph area and define the options */
	  layout overlay / /* X axis */
					   xaxisopts = (label = "x"
									display = (label tickvalues)
									type = discrete)
					   /* Y axis */
					   yaxisopts = (label = "y" linearopts=( viewmin=0 viewmax =10));

		/* Bar plot */
		barchart category=x response=y / name = "bar"
													group = grp
													groupdisplay = cluster
													display = (outline fillpattern)
													outlineattrs=(color=black) fillpatternattrs=(color=grey /*pattern =l1*/)  barwidth=0.25;

		/* Legend */
		discretelegend "bar" / title = "Group: "
							   valueattrs = (family = "arial")
							   location = outside
							   halign = center
							   valign = bottom;

	  endlayout;
	endgraph;
  end;
run;

/*Open destination*/;
ods listing close;
ods rtf file = "xxx" /*style=tfl*/;
ods graphics / reset imagefmt = png;

proc sgrender 
	data=test 
	template=testtemp;
run;

ods rtf close;
ods listing;

Hi,

 

I have attached a simplified version of what I am trying to do. I want a black outline and the fill pattern to change along with the group variable. From what I can see on the SAS GTL reference this is possible, so I'm not sure what I am missing. 

 

Unless I specify a particular pattern I cannot get a fill pattern to show up(with or without an outline), and of course having the same fill pattern for both groups is not really useful for me. Any help would be appreicated as I'm not really sure what the issue is. Also I am using SAS 9.4 M1.

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

There's a restriction under FILLPATTERATTRS in the docs:

 

The only styles that are delivered by SAS that support fill patterns are JOURNAL2, JOURNAL3, and MONOCHROMEPRINTER. If any other such style is in effect and this option uses style-element in its specification, then this option is ignored.

 

I'm not sure if changing the style would help but it's easy to try. 

View solution in original post

2 REPLIES 2
Reeza
Super User

There's a restriction under FILLPATTERATTRS in the docs:

 

The only styles that are delivered by SAS that support fill patterns are JOURNAL2, JOURNAL3, and MONOCHROMEPRINTER. If any other such style is in effect and this option uses style-element in its specification, then this option is ignored.

 

I'm not sure if changing the style would help but it's easy to try. 

bian123
Calcite | Level 5

Thank you very much, I did not notice this in the docs but this has solved it.

sas-innovate-wordmark-2025-midnight.png

Register Today!

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.


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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 1822 views
  • 0 likes
  • 2 in conversation