Data visualization with SAS programming

Proc Gcharts HBAR

Reply
N/A
Posts: 0

Proc Gcharts HBAR

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
SAS Employee
Posts: 977

Re: Proc Gcharts HBAR

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;
datalines;
1 X 1000 .50
1 Y 1000 .60
1 Z 1000 .70
2 X 2000 .40
2 Y 2000 .60
;
run;

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

proc gchart data=foo;
hbar c_var / type=sum sumvar=c_var_pct group=grp patternid=midpoint nostats;
run;
N/A
Posts: 0

Re: Proc Gcharts HBAR

Thanks Robert!

I think my question was not clear, anyways I solved my problem using weighted statistics option in proc gchart
Ask a Question
Discussion stats
  • 2 replies
  • 167 views
  • 0 likes
  • 2 in conversation