Return to Snippet

Revision: 5754
at April 1, 2008 14:03 by webonomic


Initial Code
%let name=bar4;
filename odsout '.';

/* You have to make some values 'negative' so they'll show up on
   the left side of the zero axis, but you want their labels to
   show the positive value.  Use a user-defined format to 
   accomplish this. */
proc format; picture posval low-high='000,009'; run;

data a;
input ITEM $ 1-6 left right;
format amount posval.;
illusion='Group 1'; amount=-1*left; output;
illusion='Group 2'; amount=right; output;
cards;
ITEM A  41 58
ITEM B  53 51 
ITEM C  42 33 
ITEM D  23 28
ITEM E  12 17
ITEM F  18 13
;
run;

data a; set a;
length htmlvar $500;
htmlvar='title='||quote(
 'Item: '|| trim(left(item)) ||'0D'x||
 'Group 1: '|| trim(left(left)) ||'0D'x||
 'Group 2: '|| trim(left(right))
)
||' '||
 'href="bar5.htm"';
run;


 GOPTIONS DEVICE=gif;
 
 ODS LISTING CLOSE;
 ODS HTML path=odsout body="&name..htm"
 (title="Paired-Bar Chart")
 style=minimal
 gtitle gfootnote
 ;
 goptions noborder;

goptions gunit=pct htitle=6 ftitle="swissb" htext=5 ftext="swiss";

axis1 label=none;  
axis2 label=none order=(-60 to 60 by 10) minor=none offset=(0,0) value=(h=3pct);

pattern1 v=solid color=cxbd0026;  /* reddish color */
pattern2 v=solid color=cx43a2ca;  /* this is the hex rgb color for mild blue */

legend1 label=none position=(bottom) cframe=white
 shape=bar(3,3) cborder=white across=2;

title "Paired-Bar Chart";
proc gchart data=a; 
hbar item / discrete 
 type=sum sumvar=amount 
 subgroup=illusion /* this controls the coloring */
 nostats
 maxis=axis1 /* midpoint axis */
 raxis=axis2 /* response/numeric axis */
 autoref /* reflines at every major axis tickmark */
 clipref /* put reflines 'behind' the bars */
 legend=legend1
 coutline=same
 html=htmlvar
 des="" name="&name" ;  
run;


 quit;
 ODS HTML CLOSE;
 ODS LISTING;

Initial URL
http://robslink.com/SAS/democd6/aaaindex.htm

Initial Description

                                

Initial Title
Paired Bar Chart

Initial Tags

                                

Initial Language
SAS