turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS/GRAPH and ODS Graphics
- /
- Proc Gcharts HBAR

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-14-2011 06:25 AM

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

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to deleted_user

02-14-2011 08:13 AM

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;

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;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to RobertAllison_SAS

02-15-2011 09:54 AM

Thanks Robert!

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

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