Procedure features:
SUMVAR=
Sample library member: GABSUMVR
This example graphs the total sales for each of three geographic sites (Rome, NY, Lima) along the X axis. Along the Y axis, the relative thickness of each bar shows the number of salespersons at each site. The chart shows that although NY had the highest sales (the longest bar), it also had the greatest number of salespersons (as shown by the thickness of the bar).
The procedure for this chart is:
Uncomment this line , and change the output destination to a directory and file name that makes sense for you.
*filename odsout 'c:\test\filename.htm';
PROC GAREABAR is only supported with device= ACTIVEX or ACTXIMG.
goptions reset=all dev=activex; ods html file=odsout; data totals; input Site $ Quarter Sales Salespersons; cards; Lima 1 4043.97 4 NY 1 8225.26 12 Rome 1 3543.97 6 Lima 2 3723.44 5 NY 2 8595.07 18 Rome 2 5558.29 10 Lima 3 4437.96 8 NY 3 9847.91 24 Rome 3 6789.85 14 Lima 4 6065.57 10 NY 4 11388.51 26 Rome 4 8509.08 16 ;
Because SUMVAR=SALES, the total sales are plotted along the horizontal axis (HBAR).
Because SITE*SALESPERSONS and WSTAT=PERCENT, the percentage of salespersons at each site is shown by the relative thickness of each bar along the vertical axis.
proc gareabar data=totals; hbar site*salespersons /sumvar=sales wstat=PERCENT; run;
ODS HTML CLOSE causes the HTML file to be written to disk.
ods html close;
The variables in this procedure are as follows :
site | the category variable: Lima, NY, Paris |
salespersons | the width variable, in this case displayed as a percentage along the vertical axis |
sales | the response variable (SUMVAR), displayed along the horizontal axis because, in this case, the statement is HBAR. |
Procedure features:
SUMVAR=
Sample library member: GABSUMVR
This example is similar to Example 1 and shows that the category variable can be numeric ”in this case 1, 2, 3, 4 for the four quarters of a year. The GAREABAR procedure treats all values of a numeric category variable as DISCRETE and does not calculate a midpoint even if the values of the category variable are continuous.
This example graphs the total sales for each quarter of the year along the horizontal axis. The relative thickness of each bar along the vertical axis shows the total number of salespersons during that quarter. The chart shows that as the number of salespersons increased from quarter to quarter, the total sales also increased.
The procedure is as follows:
Uncomment this line , and change the output destination to a directory and file name that makes sense for you.
*filename odsout 'c:\test\filename.htm';
PROC GAREABAR is only supported with device= ACTIVEX or ACTXIMG.
goptions reset=all dev=activex; ods html file=odsout; data totals; input Site $ Quarter Sales Salespersons; cards; Lima 1 4043.97 4 NY 1 8225.26 12 Rome 1 3543.97 6 Lima 2 3723.44 5 NY 2 8595.07 18 Rome 2 5558.29 10 Lima 3 4437.96 8 NY 3 9847.91 24 Rome 3 6789.85 14 Lima 4 6065.57 10 NY 4 11388.51 26 Rome 4 8509.08 16 ;
Because SUMVAR=SALES, the total sales are plotted along the horizontal axis (HBAR).
Because QUARTER*SALESPERSONS and WSTAT=PERCENT, the percentage of salespersons for each quarter is shown by the relative thickness of each bar along the vertical axis.
proc gareabar data=totals; hbar quarter*salespersons / sumvar=sales wstat=PCT; run;
ODS HTML CLOSE causes the HTML file to be written to disk.
ods html close;
The variables in the example are as follows:
quarter | the category variable: quarters 1, 2, 3, and 4 |
salespersons | the width variable, in this case displayed as a percentage along the vertical axis. |
sales | the response variable (SUMVAR), displayed along the horizontal axis. |
Procedure features:
SUBGROUP =
Sample library member: GABSUBGR
This example uses the SUBGROUP= option to display the same magnitudes as displayed by Examples 1 and 2. Like Example 1, this example shows the total sales for each of three geographic sites along the horizontal axis. The relative thickness of each bar along the vertical axis shows the number of salespersons at each site.
In addition, by subgrouping the response variable by quarter, this example shows the relative percentage of sales for each quarter. Thus, one can see from this chart that NY (the middle bar) had most of its sales in the fourth quarter, whereas Rome (the topmost bar) had most of its sales in the first quarter.
The value of SUBGROUP= can be character or numeric.
The procedure is as follows:
Uncomment this line , and change the output destination to a directory and file name that makes sense for you.
*filename odsout 'c:\test\filename.htm';
PROC GAREABAR is only supported with device= ACTIVEX or ACTXIMG.
goptions reset=all dev=activex; ods html file=odsout; data totals; input Site $ Quarter $ Sales Salespersons; cards; Lima 1 4043.97 4 NY 1 4225.26 12 Rome 1 16543.97 6 Lima 2 3723.44 5 NY 2 4595.07 18 Rome 2 2558.29 10 Lima 3 4437.96 8 NY 3 5847.91 24 Rome 3 3789.85 14 Lima 4 6065.57 10 NY 4 23388.51 26 Rome 4 1509.08 16 ; /* define title */ title1 'Ratio of Sales to Salespersons by Site'; title2 '(with Site subgrouped by Quarter)';
Because SUMVAR=SALES, the total sales are plotted along the horizontal axis (HBAR).
Because SITE*SALESPERSONS and WSTAT=PERCENT, the percentage of salespersons for each quarter is shown by the relative thickness of each bar along the vertical axis.
Because SUBGROUP=QUARTER and RSTAT=SUM, the quarters are displayed as absolute numbers along the horizontal bar.
proc gareabar data=totals; hbar site*salespersons /sumvar=sales subgroup=quarter rstat=SUM wstat=PCT; run; ods html close;
The variables in the example are as follows:
site | the category variable: Lima, NY, Rome. |
salespersons | the width variable, in this case displayed as a percentage (wstat=PCT) along the vertical axis. |
sales | the response variable (SUMVAR), displayed as a sum (rstat=SUM) along the horizontal axis because, in this case, the statement is HBAR. |
quarter | quarters 1, 2, 3, and 4, displayed as absolute numbers (rstat=SUM) along the horizontal bar. |
Procedure features:
SUBGROUP=, RSTAT=, WSTAT=
Sample library member: GABWSTAT
This example uses the RSTAT= option, in conjunction with the SUBGROUP= option, to display the response variable (medals won in the winter Olympics), subgrouped by the percentage (RSTAT=PCT) of each medal type (gold, silver, bronze). The width variable is the number of athletes, displayed (in this case along the vertical axis) as the percentage of athletes (WSTAT=PCT) of each of five different nationalities.
When the SUBGROUP= option is specified, you can use the RSTAT= option to specify whether the subgrouping is to be displayed as a percentage or as a sum.
The procedure is as follows:
Uncomment this line , and change the output destination to a directory and file name that makes sense for you.
*filename odsout 'c:\test\filename.htm';
PROC GAREABAR is only supported with device= ACTIVEX or ACTXIMG.
ODS LISTING CLOSE prevents the output from going to the OUTPUT window in addition to disk.
ods listing close; ods html file=odsout; goptions dev=activex; data medals; input country . medaltype $ winter summer athletes; datalines; Germany Gold 12 14 176 Germany Silver 16 17 0 Germany Bronze 7 26 0 United States Gold 10 39 210 United States Silver 13 25 0 United States Bronze 11 33 0 Norway Gold 11 4 42 Norway Silver 7 3 0 Norway Bronze 6 3 0 Canada Gold 6 3 157 Canada Silver 3 3 0 Canada Bronze 4 8 0 Russia Gold 6 32 160 Russia Silver 7 28 0 Russia Bronze 3 28 0 ;
Because SUMVAR=WINTER, this proc displays the number medals won in the winter Olympics, subgrouped by the percentage (RSTAT=PCT) of each medal type (gold, silver, bronze). The width variable is the number of athletes, displayed (in this case along the vertical axis) as the percentage of athletes (WSTAT=PCT) of each of five different nationalities.
When the SUBGROUP= option is specified, you can use the RSTAT= option to specify whether the subgrouping is to be displayed as a percentage or as a sum.
PROC GAREABAR data=medals; hbar country*athletes /sumvar=winter subgroup=medaltype wstat=percent rstat=percent; run; quit;
ODS HTML CLOSE causes the HTML file to be written to disk.
ODS LISTING restores subsequent output to the OUTPUT window.
ods html close; ods listing;
The variables in the example are as follow:
country | the category variable: Russia, Canada, Norway, United States, Germany. |
athletes | displayed as a percentage (WSTAT=PERCENT) along the vertical axis. |
winter | the value of SUMVAR, the number of medals won in the winter Olympics, displayed along the horizontal axis because, in this case, the statement is HBAR. |
medaltype | the value of SUBGROUP, displayed as a percentage (RSTAT=PERCENT) of each medal type (gold, silver, bronze). |