The sample code on the Full Code tab illustrates how to use the BAND statement in PROC SGPLOT to fill the area between plot lines.
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
/* Create the data set STOCKS */
data stocks;
input Year High Low;
datalines;
1960 685.47 568.05
1961 734.91 610.25
1962 726.01 535.76
1963 767.21 646.79
1964 891.71 768.08
1965 969.26 840.59
1966 995.15 744.32
1967 943.08 786.41
1968 985.21 825.13
1969 968.85 769.93
1970 842.00 631.16
1971 950.82 797.97
1972 1036.27 889.15
1973 1051.70 788.31
1974 891.66 577.60
1975 881.81 632.04
1976 1014.79 858.71
1977 999.75 800.85
1978 907.74 742.12
1979 897.61 796.67
1980 1000.17 759.13
1981 1024.05 824.01
1982 1070.55 776.92
1983 1287.20 1027.04
1984 1286.64 1086.57
1985 1553.10 1184.96
1986 1955.57 1502.29
1987 2722.42 1738.74
1988 2183.50 1879.14
1989 2791.41 2144.64
1990 2999.75 2365.10
1991 3168.83 2470.30
1992 3413.21 3136.58
1993 3794.33 3241.95
1994 3978.36 3593.35
1995 5216.47 3832.08
1996 6560.91 5032.94
1997 8259.31 6391.69
1998 9374.27 7539.07
1999 11497.12 9120.67
2000 11722.98 9796.03
2001 11337.92 8235.81
2002 10635.25 7286.27
2003 10453.92 7524.06
2004 10854.54 9749.99
2005 10940.55 10012.36
2006 12510.57 10667.35
2007 14164.53 12050.41
2008 13058.20 6547.05
2009 10605.70 6440.08
2010 11655.0 9596.04
2011 12928.5 10362.3
2012 13588.7 12221.2
;
run;
/* Define titles */
title1 'Dow Jones Industrial Average';
title2 h=11pt 'Highs and Lows From 1960 to 2012';
/* Create the graph */
proc sgplot data=stocks;
refline 1000 to 13000 by 2000 / axis=y lineattrs=(pattern=2);
band x=year lower=low upper=high / fillattrs=(color=vibg);
xaxis values=(1960 to 2012 by 4) label=' ';
yaxis values=(0 to 15000 by 1000) label=' ';
format high comma6.0;
run;
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> SGPLOT |
Date Modified: | 2013-12-17 11:21:50 |
Date Created: | 2013-12-12 15:37:26 |
Product Family | Product | Host | SAS Release | |
Starting | Ending | |||
SAS System | Base SAS | z/OS | 9.3 TS1M0 | |
Z64 | 9.3 TS1M0 | |||
Microsoft® Windows® for x64 | 9.3 TS1M0 | |||
Microsoft Windows Server 2003 Datacenter Edition | 9.3 TS1M0 | |||
Microsoft Windows Server 2003 Enterprise Edition | 9.3 TS1M0 | |||
Microsoft Windows Server 2003 Standard Edition | 9.3 TS1M0 | |||
Microsoft Windows Server 2003 for x64 | 9.3 TS1M0 | |||
Microsoft Windows Server 2008 | 9.3 TS1M0 | |||
Microsoft Windows Server 2008 R2 | 9.3 TS1M0 | |||
Microsoft Windows Server 2008 for x64 | 9.3 TS1M0 | |||
Microsoft Windows XP Professional | 9.3 TS1M0 | |||
Windows 7 Enterprise 32 bit | 9.3 TS1M0 | |||
Windows 7 Enterprise x64 | 9.3 TS1M0 | |||
Windows 7 Home Premium 32 bit | 9.3 TS1M0 | |||
Windows 7 Home Premium x64 | 9.3 TS1M0 | |||
Windows 7 Professional 32 bit | 9.3 TS1M0 | |||
Windows 7 Professional x64 | 9.3 TS1M0 | |||
Windows 7 Ultimate 32 bit | 9.3 TS1M0 | |||
Windows 7 Ultimate x64 | 9.3 TS1M0 | |||
Windows Vista | 9.3 TS1M0 | |||
Windows Vista for x64 | 9.3 TS1M0 | |||
64-bit Enabled AIX | 9.3 TS1M0 | |||
64-bit Enabled HP-UX | 9.3 TS1M0 | |||
64-bit Enabled Solaris | 9.3 TS1M0 | |||
HP-UX IPF | 9.3 TS1M0 | |||
Linux | 9.3 TS1M0 | |||
Linux for x64 | 9.3 TS1M0 | |||
Solaris for x64 | 9.3 TS1M0 |