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:
PROC GCHART DATA=WORK.mydata;
BLOCK curr_group /
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,
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.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.