BookmarkSubscribeRSS Feed
Not applicable
I have a chart variable and a group variable,i need to create Horizontal bar charts out of those.

My data looks like these

Grp C_Var G_FREQ C_var_pct
1 X 1000 50%
1 Y 1000 60%
1 Z 1000 70%
2 X 2000 40%
2 Y 2000 60%

Grp is the Group Variable and C_Var is the Chart Variable

The Length of the bars should reflect the C_var_pct and value of variables G_FREQ and C_var_pct should be present in the outputs.

Can you guys help me out on this.

Message was edited by: RKarthik Message was edited by: RKarthik
Meteorite | Level 14
There are basically 2 ways to plot this data that come to mind - I'm sure
exactly which way you're wanting, so I included both...

data foo;
input Grp C_Var $ G_FREQ C_var_pct;
1 X 1000 .50
1 Y 1000 .60
1 Z 1000 .70
2 X 2000 .40
2 Y 2000 .60

proc gchart data=foo;
hbar grp / discrete type=sum sumvar=c_var_pct subgroup=c_var nostats;

proc gchart data=foo;
hbar c_var / type=sum sumvar=c_var_pct group=grp patternid=midpoint nostats;
Not applicable
Thanks Robert!

I think my question was not clear, anyways I solved my problem using weighted statistics option in proc gchart




The early bird rate has been extended! Register by March 18 for just $695 - $100 off the standard rate.


Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 


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