Colorizing SCL Programs

Rick Aster

When you create SAS/AF and SAS/FSP applications, you edit SCL programs in the Source window. This window looks and acts much like the Program Editor window, but it has one capability that the Program Editor does not have. In the Source window, you can give different parts of a program different colors, and those colors are stored with the program.

You can use this feature to colorize SCL programs. Color has no effect on the execution of an SCL program, but it can be useful to the programmer. The systematic use of color in an SCL program can emphasize the program’s structure and make it easier to read quickly.

SAS colors

Use the COLOR command to change colors in the Source window. The most useful form of the command is


which changes the color of selected text. For example, select several lines of text, then issue the command COLOR MTEXT GREEN to make the selected text green.

SAS software supports a standard set of colors. You can refer to a color by its name or by one-letter abbreviations. These are the most consistently supported colors:


Along with colors, you can assign video attributes, such as REVERSE and UNDERLINE. You can assign the different colors to function keys — for example, assign the command COLOR MTEXT G to one function key and COLOR MTEXT K to another, and so on.

Color schemes for SCL

The simple way to emphasize the structure of an SCL program is to give its different components different colors: one color for SCL statements, another for submitted statements, and so on. Working on a WHITE background, this is the color scheme I use most often:

SCL statements: BLACK
Comments: BLUE
Statements commented out: GRAY
Statement labels of program sections: RED REVERSE
Other statement labels: RED
Submitted statements: GREEN
Debugging statements: RED

On a BLACK background, I would suggest substituting WHITE for SCL statements, CYAN for comments, and YELLOW UNDERLINE and YELLOW for statement labels.

Different color schemes work best for different kinds of SCL programming. Black is the easiest color to read on a white background (or white on a black background), so use it for most of the program. My programs contain mostly SCL statements, so I use black for SCL statements. If your SCL programs consist mostly of submitted statements, you might want to make the submitted statements black. If submitted statements always come at the end of your SCL programs, you might use black for both SCL statements and submitted statements.

These are some of the kinds of things you might want to emphasize with color:

Reading in color

Colorizing, like writing comments, is an investment. Even with a mouse and function keys, it can take several minutes to select each component of an SCL program and color it. The extra coding time, however, can more than pay for itself when you debug and revise the program. Before I started colorizing my SCL programs, I could, just as one example, spend two or three minutes poking through a program to find a submitted statement that I needed to change. With a colorized program, I can focus only on the green statements and find the problematic statement in seconds. The REVERSE attribute on statement labels that begin program sections is especially helpful; you can see a program’s phases and subroutines at a glance. When color is used meaningfully, reading in color can be much faster than reading in black and white.

There is another benefit to colorizing SCL that may not be so obvious. Colorizing a new program forces you to read the program an extra time. In the process, you may notice errors — you’re bound to notice a missing statement label, for example. If you catch and correct an error or two in the colorizing process, you have actually saved time while adding color.

Other things to color

The COLOR command can color more then just MTEXT, selected text. These are other parts you can use in the COLOR command:

There is little risk in experimenting with color in an SCL program. If you change your mind about a color scheme, it’s no problem to select the whole program and change it back to plain black. If you’re an SCL programmer, try colorizing two or three programs. I'm sure you can find a color scheme that makes your SCL programs easier for you to read.