Building models with SAS Enterprise Miner, SAS Factory Miner, SAS Visual Data Mining and Machine Learning or just with programming

100% stacked bar chart on character data

Regular Contributor
Posts: 218

100% stacked bar chart on character data

Hi there,

following code (copied from somewhere in this forum) does a 100% stacked bar chart on month and sell, but I want to do it on month and grp, can anyone tell me the code for that. I know I may have to do a freq table first, but no idea how that freq table will be helpful.

data in2;

    input grp $ sell month $;


shoes    882    Jan

shoes    280    Feb

shoes    602    Mar

shoes    223    Apr

shoes    221    May

shoes    842    Jun

socks    280    Jan

socks    633    Feb

socks    465    Mar

socks    625    Apr

socks    104    May

socks    403    Jun

tee    763    Jan

tee    637    Feb

tee    141    Mar

tee    102    Apr

tee    663    May

tee    98    Jun


/* Suppress the group axis label and values */                                                                                        

axis1 label=none value=none;                                                                                                          


/* Angle the label for the response axis */                                                                                           

axis2 label=(angle=90 'Percent');                                                                                                     


proc gchart data=in2;                                                                                                                

   vbar month / discrete subgroup=grp                                                                                           

                 group=month g100 nozero                                                                                             

                 freq=sell type=percent                                                                                              

                 inside=percent width=20

                  gaxis=axis1 raxis=axis2 ;                                                                                         




Super User
Posts: 11,343

Re: 100% stacked bar chart on character data

Stacked 100% tends to imply that you have a subgroup variable that would be indicated in the chart. What variable would that be? Sell doesn't make much sense in this case.

I would look here:

and here:

to find something that looks like the result I wanted and use that as a model.

Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation