Help using Base SAS procedures

Proc gchart

Reply
N/A
Posts: 0

Proc gchart

Does anyone know how to assign specific colors to values of the Subgroup Variable in Proc gchart when using by-groups?

IE: I'm producing Charts by Month and the Bars have a subgroup "Type" = Light, Medium, Heavy, etc.

It seems like Proc gchart assigns the colors for the Subgroup based on the First, Second, Third, .... "Type" it encounters for Each by-group. The effect isSub-group categories can be coloured differently depending on the Month.


What I want is for each Type Value to have the same color in every chart.

Thanks.
Super Contributor
Posts: 291

Re: Proc gchart

Posted in reply to deleted_user
I think this document will help you get started - http://support.sas.com/kb/24/874.html
N/A
Posts: 0

Re: Proc gchart

Thanks for the response Bill.

The Code structure of your solution has a similar form to a Mechanism I use to Produce separate PDFs for by-groups (another feature I wish SAS would implement) so I should be able to fumble through it.

In this case I have worked out a Partial Solution to my problem that Pre-processes the Data to determine all the possible Variable combinations for the By-group, Vbar, & Sub-group and creates Dummy observations so that Every Sub-group is reflected in every (by-group * Vbar combination). The Dummy Observations have "Zero" for the Quantity I intend to graph.

That way, when Proc Gchart encounters Every Sub-group for Every chart it generates in the By-group & Every Column on the x-axis in the same order.

Thus: The Colours assigned to the Sub-groups in the First round are the same for every Graph.

The only drawback to my solution is That Every Sub-group for Every chart appears in the Legend. Not a huge problem as it is a relatively small number plus it reminds the User of the categories to expect in other graphs. I say close enough.

Now I plan to use the provided document to improve my fix so that I can Specify the colours to use, which would be sweet.

At a glance It appears that the Fix in the Link requires that the User have Prior Knowledge of the Number and Names of the Sub-groups. Not a problemin this case, but I always prefer Robust techniques to Hard-coding.


SAS - If you are listening this would be a welcome Feature for a new release.
Ask a Question
Discussion stats
  • 2 replies
  • 114 views
  • 0 likes
  • 2 in conversation