BookmarkSubscribeRSS Feed
mlogan
Lapis Lazuli | Level 10

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 $;

    datalines;

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 ;                                                                                         

run;                                                                                                                                  

quit;

Thanks,

1 REPLY 1
ballardw
Super User

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: Support.sas.com

and here: http://robslink.com/SAS/

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 756 views
  • 3 likes
  • 2 in conversation