FOCUS AREAS

Graphics

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

data bandMulti; 
  format Date Date9.; 
  do i=0 to 334 by 1; 
   date='01jan2009'd+i; 
   A = 16+ 3*sin(i/90+0.5) + 1*sin(3*i/90+0.7); upperA=a*1.1; lowerA=a*0.95; 
   B = 11+ 3*sin(i/90+0.5) + 1*cos(3*i/90+0.7); upperB=b*1.1; lowerB=b*0.95; 
   C = 12+ 3*cos(i/90+0.5) + 1*sin(3*i/90+0.7); upperC=c*1.1; lowerC=c*0.95; 
   output; 
  end; 
data InterestRates; 
  set bandMulti;
  format a b c percent.;
  A = A / 600; 
  B = B / 600; 
  C = B / 600; 

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

title 'Mortgage Interest Rates over Time';
proc sgplot data=interestrates noautolegend;
  band x=date upper=a lower=b / fillattrs=graphdata1 name='a' transparency=0.6 
       legendlabel='30 Year Fixed';
  series x=date y=a / lineattrs=(thickness=3);
  band x=date upper=b lower=0  / fillattrs=graphdata2 name='b'  transparency=0.6
       legendlabel='15 Year Fixed';
  series x=date y=b / lineattrs=(thickness=3);
  keylegend 'a' 'b' / location=inside position=topright across=1;
  xaxis grid display=(nolabel) offsetmin=0 offsetmax=0;
  yaxis grid display=(nolabel) values=(0 to 0.03 by 0.005) offsetmin=0 valueshint;
run;