A vertical line can be drawn between ACROSS variable column groups by using the new SAS® 9.2 border controls.
The vertical line for the header portion is added through the STYLE(HEADER) option on the DEFINE statement for the ACROSS variable. The color of the vertical line can be controlled using a format as the value for the BORDERRIGHTCOLOR option. The BORDERRIGHTWIDTH option uses a format as well. Using a format allows the values to be toggled based on the variable value.
To draw the vertical line in the detail data, a COMPUTE block is used. A CALL DEFINE statement applies the BORDERRIGHTWIDTH option to the sixth column, which is the end of the first ACROSS variable value group.
See the code on the Full Code tab for an illustration.
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 example input data set. */
data example;
input foodcat $ food $8. storage $ life $ cost 8.2;
datalines;
dairy icecream freezer 12 5.00
dairy milk freezer 1 3.50
dairy milk shelf 1 3.50
dairy cream shelf 1 2.00
dairy bars freezer 6 1.50
dairy butter shelf 6 4.50
dairy sherbert freezer 12 4.00
fruit berries freezer 12 6.00
fruit banana shelf 1 2.00
fruit pops freezer 6 3.50
fruit apple shelf 1 1.00
fruit canned shelf 121 2.50
fruit snacks shelf 6 3.00
;
run;
proc format;
/* For use with the BORDERRIGHTWIDTH option */
value $myfmt '12'='7'
other='1';
/* For use with the BORDERRIGHTCOLOR option */
value $mycolor '12'='black'
' 12'='black'
other='white';
/* Format to get the ACROSS variables in the desired order when using ORDER=FORMATTED */
value $life '1'=' 1'
'6'=' 6'
'12'='12'
'121'=' 12';
/* For use with the BORDERRIGHTCOLOR option */
value $mystor 'freezer'='7'
other='1';
run;
ods tagsets.rtf file='mytagrtf.rtf' ;
ods rtf file='myrtf.rtf' ;
proc report nowd data=example style(header)=[background=_undef_];
column foodcat food (storage,life),cost ;
define foodcat / group noprint;
define food / group ' ';
define storage / across ' ' style(header)={borderrightwidth=$mystor.} nozero;
define life / across ' ' format=$life.
style(header) ={borderrightcolor=$mycolor. borderrightwidth=$myfmt.};
define cost / format=dollar8.2 ' ';
compute before foodcat;
line foodcat $;
endcomp;
compute cost;
call define('_c6_','style','style={borderrightwidth=7}');
endcomp;
run;
ods rtf close;
ods tagsets.rtf close;
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 ==> REPORT |
Date Modified: | 2010-08-31 10:59:39 |
Date Created: | 2010-05-14 17:16:04 |
Product Family | Product | Host | SAS Release | |
Starting | Ending | |||
SAS System | Base SAS | Microsoft Windows Server 2003 Enterprise Edition | ||
Microsoft Windows Server 2003 Datacenter Edition | ||||
Microsoft Windows NT Workstation | ||||
Microsoft Windows 2000 Server | ||||
Microsoft Windows 2000 Professional | ||||
Microsoft Windows 2000 Datacenter Server | ||||
z/OS | ||||
OpenVMS VAX | ||||
Microsoft Windows 95/98 | ||||
Microsoft Windows 2000 Advanced Server | ||||
Microsoft® Windows® for x64 | ||||
OS/2 | ||||
Microsoft Windows Server 2003 Enterprise 64-bit Edition | ||||
Microsoft Windows XP 64-bit Edition | ||||
Microsoft Windows Server 2003 Datacenter 64-bit Edition | ||||
Microsoft® Windows® for 64-Bit Itanium-based Systems | ||||
Microsoft Windows Server 2003 Standard Edition | ||||
Microsoft Windows Server 2008 | ||||
Microsoft Windows XP Professional | ||||
Windows 7 Enterprise 32 bit | ||||
Windows 7 Enterprise x64 | ||||
Windows 7 Home Premium 32 bit | ||||
Windows 7 Home Premium x64 | ||||
Windows 7 Professional 32 bit | ||||
Windows 7 Professional x64 | ||||
Windows 7 Ultimate 32 bit | ||||
Windows 7 Ultimate x64 | ||||
Windows Millennium Edition (Me) | ||||
Windows Vista | ||||
64-bit Enabled AIX | ||||
64-bit Enabled HP-UX | ||||
64-bit Enabled Solaris | ||||
ABI+ for Intel Architecture | ||||
AIX | ||||
HP-UX | ||||
HP-UX IPF | ||||
IRIX | ||||
Linux | ||||
Linux for x64 | ||||
Linux on Itanium | ||||
OpenVMS Alpha | ||||
OpenVMS on HP Integrity | ||||
Solaris | ||||
Solaris for x64 | ||||
Tru64 UNIX |