You are on page 1of 2

A COLOR SCHEME FOR SCL PROGRAMS

Rick Aster

Introduction
An SCL program, like any computer program, consists only of text. Programmers looking for a way to reinforce the meaning and structure of a program are usually limited to spacing and comments. For example, to make the sections of a program easier to find, you can place blank lines between them. In the case of an SCL program, the Source window of SAS/AF software also lets you add color and video attributes to selected text of the program. Using color, in particular, can enhance the visual impact of the structure of an SCL program. This paper introduces a color scheme that can be used on SCL programs. This color scheme is generally useful for SCL programs of all kinds. It is also meant as an example of the possibility of using color to reinforce SCL program text. This paper also describes the process of applying color in the Source window, which is the same regardless of the specific color scheme you use.

Text colors on white background Contrast Visibility K BLACK + B BLUE + G GREEN + R RED + C CYAN M MAGENTA A GRAY Text colors on black background Contrast Visibility W WHITE + + Y YELLOW + + M MAGENTA C CYAN A GRAY R RED G GREEN

Readability

+ Readability

Color
The Source window displays text against a background of either white or black. You can choose any of the available SAS colors for the color of any part of the text that makes up the SCL program. These are qualities to consider in selecting colors:

+ +

+ high medium - low


In some operating systems, you may be able to change the background color. It is best, though, to use white or black for the background. These background colors provide good contrast with most of the other SAS colors.

Contrast. A text color must be different enough in brightness to stand out from the background. Yellow text on a white background or blue text on a black background may not always provide enough contrast to be usable. Visibility. Some colors are more visible, meaning the reader notices them more quickly. Use high-visibility colors to call attention to key points in the structure of the program. Readability. Speed, comprehension, and ease of reading are the main factors of readability. Use highly readable colors for most of the text that makes up the program. It is perfectly okay to use low-readability colors for single words, short phrases, or repeated text, but they can cause reader fatigue if you use them for blocks of text.
The following tables rate selected SAS colors for contrast, visibility, and readability. You can identify a SAS color by name or one-letter code, as shown. The appearance and effects of color vary according to operating system and display hardware, so what you see on your screen may be slightly different.

Video Attributes
Along with color, SAS software lets you apply video attributes to text. The most useful video attribute is reverse video (R), which swaps the text color and background color for the selected text. When applied to a line of text, reverse video lends high visibility with no loss of readability. Another video attribute, underline (U), may occasionally be useful, but is not supported by all operating systems and display hardware. The two other video attributes are not recommended for use in programs blinking (B) because it is distracting, and highlighting (H) because it is not widely supported.

The COLOR command


Use the COLOR command to apply color to text. First, select the text to color. Use a mouse if possible, or the MARK command if a mouse is not available. Then issue

either of these forms of the COLOR command: COLOR MTEXT color COLOR MTEXT color video attribute The command changes the color and, optionally, applies a video attribute to the selected text. For example, the command COLOR MTEXT G makes the selected text green. The command COLOR MTEXT RED R applies the color red and the reverse video attribute to the selection, so that the background is red and the text is the usual background color. After you use the COLOR command, the colors you apply are stored with the text of the SCL program the next time you save the entry that contains the program. Issuing the COLOR command You can issue the COLOR command simply by entering it in the command line. Applying a color scheme to a program requires you to issue the same commands repeatedly, with different text selected each time. One shortcut is to recall previously typed COLOR commands using the command-line menu feature of the display manager GUI interface. Another alternative is to assign the various COLOR commands to function keys in the Keys window and use the function keys to issue the commands.

Statement labels of subroutines and references to statement labels: RED Debugging statements: RED To achieve a similar effect on a BLACK background, substitute WHITE for BLACK, CYAN for BLUE, and YELLOW for RED.

Costs and benefits


Applying colors to a program takes only a short time; a typical pace is approximately 50 lines of SCL code per minute. This is not much compared to the total time taken by the programming process, which is more typically measured in lines of code per day. The first benefit of color comes when you must read and understand the code in order to apply the colors correctly. The author catches most of the errors in his SCL code at this stage and has actually found it to be a faster way to find and correct syntax errors than is compiling and checking the compilers error and warning messages. The principal benefit, however, is in the ease of reading the colorized program. A good color scheme can improve both speed and comprehension in reading an SCL program. Programmers must at least read their programs in the debugging process. The time saved in reading a colorized program while debugging is often greater than the time spent colorizing. If an error is located in submitted statements, the distinctive color of the submitted statements lets you find the error at a glance, rather than having to skim the program to locate it. For an error in the SCL code, the use of color to identify the program phases can focus your attention on the one particular phase where the problem is located. The increased readability of the program may be of even greater value to a maintenance programmer who must learn about the program by reading it. A successful program is one that makes sense both to the compiler and to the programmers who work with it. The use of a simple, consistent color scheme, such as the one described here, is an easy way to make SCL programs make more sense to the programmers.

Objectives
In designing a color scheme, the author considered these primary objectives. Differentiate SCL statements from submitted statements. Visually identify comments. Call attention to the high-level outline and control flow of the program. The color scheme applies a high-visibility color and reverse video for the reserved statement labels and screen variable statement labels that mark the beginning of program phases. It uses separate colors for SCL statements, comments, and submitted statements (using three colors of good readability). A low-visibility color is used to avert attention from statements that are commented out, while a high-visibility color is applied to debugging statements so they do not go forgotten when debugging is complete.

References
SAS and SAS/AF are registered trademarks of SAS Institute Inc. 1998 Rick Aster Contact: Rick Aster Breakfast Communications Corporation P.O. Box 176 Paoli, PA 19301-0176 finis@pond.com http://www.pond.com/~finis/sas

Recommended color scheme


To meet the stated objectives, the author recommends this color scheme for an SCL program on a WHITE background. SCL statements: BLACK Submitted statements: GREEN Comments: BLUE Statements commented out: GRAY Statement labels of program phases: RED R

You might also like