BookmarkSubscribeRSS Feed
Calcite | Level 5

I know that there are a lot of support materials on Proc GCHART but I have not been able to apply them to the type of chart I would like to produce.

I have produced a grouped bar chart which shows a 3D chart with blocks for each currency in different colors. There are two blocks for each currency on the x axis, one for "Company A" and one for "Company B" (var=activity_typ).

Is there any way that I can retain the colors assigned to the MIDPOINT variable (curr_group) but assign a lighter transparency or some sort of cross-hatch pattern to the different groups of the GROUP variable (activity_typ)? So that, for example, the bar for USD would be light red for Company A and dark red for Company B?

My code is as follows:


  BLOCK  curr_group  /





/* Anno=anno*/









Super User

Classic Gchart behavior is basically that the first level encountered is assigned the appearance values of the first Pattern statement, the 2nd the second pattern and so on. Getting specific colors/ shade with any consistency means having all levels of variables represented in each combination of categories and sorting and getting Pattern definitions to align. Add a new category- start over.

This may require have a missing value for the sumvar (amount) for group variable (activity_typ) if every level of the block variable (curr_group) doesn't have all levels of the group variable.

If you are using 9.4 there are options with the SG procedures to assign color attributes to levels of variables so they are consistent regardless of sort order or value presence in the data,

Meteorite | Level 14

If I am understanding your requirement, you want the bars to be colored by midpoint (along x axis, say 'A', 'B', 'C' and so on colored say Blue, Red, Green.  For each categoryyou have 2 group levels, say 'X' and 'Y'.  Normally, in such a case, the standard procedure is to assign colors to the groups, and not to each category.  The categories are labeled on the x-axis anyway, so using an additional color for the category is considered unnecessary and potentially confusing.   From an "Effective Graphics" perspective this is not recommended.

Having said that, it is possible to do something like this using SG or GTL. One way is described by Ballardw.  Another would be to overlay two VBAR statements one each for the two groups, shifted left and right using DiscreteOffset, with narrower bars.  This will need restructuring your data from group to multi-column (easily done).  The Bars can be grouped by category so each midpoint will get different color.  Now, for the 2nd VBAR, you can set a transparency value to make it look lighter.

Calcite | Level 5

Thank you Sanjay and ballardw. I may need to re-think whether additional shading/colours will add clarity, but your suggestions have given me some great solutions to work with!



Secure your spot at the must-attend AI and analytics event of 2024: SAS Innovate 2024! Get ready for a jam-packed agenda featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events.


Register by March 1 to snag the Early Bird rate of just $695! Don't miss out on this exclusive offer. 


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
  • 3 replies
  • 3 in conversation