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
- /
- 100% per bar in a subgrouped and grouped vbar poss...

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

01-03-2013 03:46 AM

Dear all,

I have a proc gchart with vbar, group and subgroup. The type is percent. If I don't add anything then 100% is the whole chart. If I add the option g100 then 100% is within one group. Now, my customer wants 100% per bar in this chart. Is that possible?

Best wishes

Eva

Accepted Solutions

Solution

01-03-2013
11:45 AM

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

01-03-2013 11:45 AM

Is that it?

class make type cylinders;

var enginesize;

output out=summary sum=;

by make type;

tables cylinders / out=pct nocum;

weight enginesize;

vbar make / group = type

subgroup = cylinders

sumvar=percent

type=sum

;

All Replies

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

01-03-2013 10:41 AM

A code example of what you attempted would be helpful.

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

Posted in reply to ballardw

01-03-2013 10:57 AM

proc gchart data=sashelp.cars (where=(make in ("Audi","BMW")));

vbar make / freq = enginesize

group = type

subgroup = cylinders

type=percent

g100 /* effect: one group=100% , but I need one bar=100% */

;

run;

quit;

Solution

01-03-2013
11:45 AM

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

01-03-2013 11:45 AM

Is that it?

class make type cylinders;

var enginesize;

output out=summary sum=;

by make type;

tables cylinders / out=pct nocum;

weight enginesize;

vbar make / group = type

subgroup = cylinders

sumvar=percent

type=sum

;

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

Posted in reply to data_null__

01-03-2013 11:49 AM

Yes! I always searched for a vbar Option... But a proc freq before the proc gchart is best :-)

Thanx for your help data_null_.

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

01-03-2013 11:52 AM

I'm not sure quite what you want but if each bar should total to 100 across the cylinder count you may need to process your data a bit before taking it to GCHART.

Maybe this is what you are looking for?

proc freq data=sashelp.cars (where=(make in ("Audi","BMW"))) noprint;

table make* type *cylinders/ outpct out=work.cars;

run;

proc gchart data=work.cars (where=(make in ("Audi","BMW")));

vbar make / sumvar=Pct_row

group = type

subgroup = cylinders

type=sum

;

label pct_row='Percent of Engine Cylinders' ;

run;

quit;