Butterfly Plot
Butterfly Plot
Base SAS: ODS Graphics Procedures: SGPLOT

data ButterFly;
  length AgeGroup $12; 
  do AgeGroup='Pre Teen', 'Teen', 'Young Adult', 'Adult', 'Senior';
    Male=round(-500*(1+ranuni(2))); Female=round(400*(1+ranuni(2))); zero=0; output;

proc format;
  picture positive low-<0='0000' 0<-high='0000';

/* Open the LISTING destination and assign the LISTING style to the graph */ 
ods listing style=listing;
ods graphics / width=5in height=2.81in;

title 'Population by Age and Sex';
proc sgplot data=ButterFly noautolegend;
  format male female positive.;
  hbarparm category=agegroup response=male / dataskin=sheen name='m' 
    fillattrs=graphdata1 datalabel=male datalabelattrs=(size=10) transparency=0.2;
  hbarparm category=agegroup response=female / dataskin=sheen name='f'
    fillattrs=graphdata2 datalabel=female datalabelattrs=(size=10) transparency=0.2;
  scatter x=zero y=agegroup / markerchar=agegroup markercharattrs=(size=11 weight=bold);
  keylegend 'm' 'f';
  xaxis values=(-1000 to 1000 by 200) display=(nolabel) grid offsetmin=0.05 offsetmax=0.05;
  yaxis display=(noticks novalues nolabel);