Sample 35163: Needle Plot with Filled Areas
This sample uses the SGPLOT procedure to create a needle plot with filled areas.
This sample uses the SGPLOT procedure to create a needle plot with filled areas.
proc format;
value matfmt
1='1 mo'
2='3 mo'
3='6 mo'
6='1 yr'
7='2 yr'
8='3 yr'
9='5 yr'
11='10 yr '
14='30 yr';
picture yldfmt
low-high='9%';
run;
data yield;
input matcur yldcur mat1mo yld1mo mat1yr yld1yr; label yldcur='January 2008' yld1mo = 'December 2007'
yld1yr = 'January 2007';
format mat1yr matfmt. mat1mo matfmt. matcur matfmt.
yldcur yldfmt. yld1mo yldfmt. yld1yr yldfmt.;
datalines;
1 2.63 1 2.76 1 4.97
2 2.86 2 3.04 2 5.12
3 2.86 3 3.37 3 5.16
6 2.69 6 3.31 6 5.07
7 2.36 7 3.19 7 4.89
8 2.39 8 3.2 8 4.8
9 2.86 9 3.53 9 4.75
11 4.3 11 4.6 11 4.94
14 4.28 14 4.55 14 4.85
;
run;
title 'Government Bond Yield Curve';
ods html file='BondMaturity' path='.' style=curve;
ods graphics / reset width=600px height=400px imagename='BondMaturity' imagefmt=gif;
proc sgplot data=yield cycleattrs noautolegend;
band x=mat1yr upper=yld1yr lower=0/ name='b1' legendlabel='January 2007';
band x=mat1mo upper=yld1mo lower=0 / name='b2' legendlabel='December 2007';
band x=matcur upper=yldcur lower=0 / name='b3' legendlabel='January 2008';
series x=mat1yr y=yld1yr / markers markerattrs=(color=white symbol=circlefilled)lineattrs=(pattern=solid);
series x=mat1mo y=yld1mo / markers markerattrs=(color=white symbol=circlefilled)lineattrs=(pattern=solid);
series x=matcur y=yldcur / markers markerattrs=(color=white symbol=circlefilled)lineattrs=(pattern=solid);
needle x=matcur y=yld1yr / lineattrs=(color=white pattern=solid);
yaxis label='Bond Yield' offsetmin=0;
xaxis values=(1 2 3 6 7 8 9 11 14) label='Bond Maturity';
keylegend 'b1' 'b2' 'b3';
run;
ods html close;
ods listing;
This sample uses the SGPLOT procedure to create a needle plot with filled areas.
| Type: | Sample |
| Topic: | SAS Reference ==> Procedures ==> SGPLOT
|
| Date Modified: | 2009-03-20 14:37:05 |
| Date Created: | 2009-03-17 14:17:17 |
Operating System and Release Information
| SAS System | SAS/GRAPH | z/OS | 9.2 TS2M0 | |
| Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.2 TS2M0 | |
| Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.2 TS2M0 | |
| Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.2 TS2M0 | |
| Microsoft Windows XP 64-bit Edition | 9.2 TS2M0 | |
| Microsoft® Windows® for x64 | 9.2 TS2M0 | |
| Microsoft Windows Server 2003 Datacenter Edition | 9.2 TS2M0 | |
| Microsoft Windows Server 2003 Enterprise Edition | 9.2 TS2M0 | |
| Microsoft Windows Server 2003 Standard Edition | 9.2 TS2M0 | |
| Microsoft Windows XP Professional | 9.2 TS2M0 | |
| Windows Vista | 9.2 TS2M0 | |
| 64-bit Enabled AIX | 9.2 TS2M0 | |
| 64-bit Enabled HP-UX | 9.2 TS2M0 | |
| 64-bit Enabled Solaris | 9.2 TS2M0 | |
| HP-UX IPF | 9.2 TS2M0 | |
| Linux | 9.2 TS2M0 | |
| Linux for x64 | 9.2 TS2M0 | |
| OpenVMS on HP Integrity | 9.2 TS2M0 | |
| Solaris for x64 | 9.2 TS2M0 | |