![]() | ![]() | ![]() | ![]() |
/* Set graphics options */
goptions reset=global border ftext=swiss colors=(black);
/* Create input data set, A */
data a;
input maxis1 $ 1-40 total 42-43;
datalines;
Accuracy of the Order you Placed 95
Overall total of Orders for Breakfast 80
Overall total of Orders for Lunches 85
Temperature of all of the Food Ordered 78
Value for the Money 87
;
/* Create macro variables MAXIS2 and TOTAL. The */
/* TOTAL macro variable contains the total number */
/* of observations in the data set. The END=option */
/* on the SET statement creates the varible EOF */
/* that signals the end-of file. */
data _null_;
set a end=eof;
call symput('maxis2' || left(_n_),"'" || trim(maxis1) || "'");
if eof then do;
call symput('total',_n_);
end;
run;
/* The MCDOLOOP macro is used to pass the long character */
/* string to the VALUE= option in the AXIS statement in the */
/* PROC GCHART step. */
%macro mcdoloop;
%do i=1 %to &total;
&&maxis2&i
%end;
%mend mcdoloop;
/* Create axis characteristics. The values of the macro */
/* variables generated by the %DO loop in MCDOLOOP macro change */
/* for each observation. */
axis1 value=(%mcdoloop) label=none;
axis2 label=('Total');
/* Define patterns for the bars */
pattern1 v=solid c=blue;
/* Add title */
title 'Survey Results';
/* Produce the chart */
proc gchart data=a;
hbar maxis1 / maxis=axis1 raxis=axis2 sumvar=total nostats;
run;
quit;| Type: | Sample |
| Topic: | SAS Reference ==> Procedures ==> GCHART Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Elements ==> Labels |
| Date Modified: | 2005-08-24 16:06:29 |
| Date Created: | 2004-11-11 11:07:55 |
| Product Family | Product | Host | SAS Release | |
| Starting | Ending | |||
| SAS System | SAS/GRAPH | All | 8 TS M0 | n/a |




