Advanced PROC REPORT: Traffic Lighting - Controlling Cell Attributes With Your Data

From sasCommunity
Jump to: navigation, search


Color or shading is often used in a report table to attract the reader's eye to specific locations or items. The color can be fixed or it can be data dependent. Of course when the color or shading is dependent on the value presented in a given cell, manual construction of the table can be very tedious. Fortunately, with the advent of the Output Delivery System, a number of new capabilities have become available to the SAS® programmer. These include the ability to automatically control the color or shading of a particular cell of the table, and to even base that control on the data itself. The control of cell attributes, such as foreground and background color, is known as traffic lighting.

While traffic lighting can be performed on tables generated by TABULATE and PRINT as well, PROC REPORT has the more sophisticated capabilities. The CALL DEFINE statement is only available in the REPORT step's compute block, and the STYLE= option is more complex. This paper will discuss the use of user defined formats with the STYLE= option and the CALL DEFINE statement to control cell attributes. The discussion will include interactions with data summaries, computed variables, and various ODS destinations, such as RTF, PDF, and HTML.

Online Materials

View the pdf for this paper on traffic lighting using PROC REPORT..

Contact Info

Please check out my user page. You can also email me.

See also