Get some SAS tools
Contents Index Conventions First Page Web Site
Next Section Previous Section

Special Processing for SAS files

Syntax highlighting

The editor has a range of groupings of items that can have coloring or highlighting based on their content or syntactical meaning. The editor has been setup to work with the SAS language. If you don't like our choices for colors, fonts etc. you can change them. Select the menu item Tools-Customize-Colors. In the Color dialog select the color template SAS. If you wish to regroup keywords (you want the data keyword treated like the proc keyword) select from the menu Tools-Customize-Languages. Select the SAS language. The keyword lists are at the top of the panel. You can now move keywords from one list to another. Keywords must be blank separated and contain only alphanumeric characters. The rest of this section lists the syntactic groupings and their characteristics.

Group

Style

Examples

The keywords, functions, and procedures are in bold typeface and broken up by color in the following groups.

   

Executable statements

bold, blue

data, do, if, put

Declarative statements

bold, red

array, by, drop, label

Procedures

bold, green

sort, dataset, tabulate, print

Functions and operators

bold, dk purple

max, date, ranuni, eq, lt

The comments are broken into the following groups.

   

Open close

green, italic

/*a comment*/

End of line 1

green

* in col 1

End of line 2

dark blue, italic

/ in col 1 - used for JCL in the file.

The Rest of the syntax.

   

Quoted strings

italic, red

'abcd' "efgh"

Numeric text

dk purple

4, 9.35, 88

Symbols

pink, bold

+, -, /, ;

Problematic Characters

Some characters that are allowed or used in programs can cause unplanned text changes during file transfers. When you save a file with the SAS extension all || character groups are converted to their equivalent !! (concatenation symbols). All ^= (not equal operator) character groups are converted to the equivalent ne.

Automatic Indention and End Commenting

As you type code, smart indenting will reposition your cursor to the correct column every time you press enter at the end of a line. The indent macro examines the code you typed (and the lines before the current line) in order to determine what should happen to the indent level. This works both when you are typing lines serially or if you insert lines in the middle of existing code.

The rules that are used to determine indent level can be broken into a small number of statement types. The standard indent amount is 2 spaces. Two spaces were chosen because it provides enough of a visual clue without using a lot of line space for those limited to 72 columns. Continued lines, e.g., lines that don't end in a semicolon are indented 4 spaces. A line is indented if it occurs after an enclosing structure such as do ... end , or data ... run . A closing syntax word is a keyword like end or run. When a closing syntax word is encountered the word is un-indented and the indent level is moved to the left.

Additionally, when an end keyword is encountered, an end comment like /* if */ is tacked on to the end of the line after the semicolon. This comment identifies the keyword that began the syntactical block. This is useful in deeply nested code. If a %mend is encountered it is similarly labeled with the name of the macro.

Special Processing for LOG Files

Automatic Clean Up

Since Multi-Edit is used with a screen, not a Teletype, the log file is cleaned up. Notably all multiple occurrences of the same line (like printing an error number 3 times) have been reduced to one line. Multiple blank lines have been reduced to a single line. Error messages with numbers have been moved up to the line that generated the error. Viewing the log files is inhanced with routines that can subset text based on messages or keywords. In the example below you can see that the textual error message is listed below the error column marker instead of being 30 lines later.

 200 w=.;
              _
200 ERROR 200-322: The symbol is not recognized.  

Syntax Highlighting

Syntax highlighting in log files is similar to the SAS files, but some of the coloring is different. The coloring for SAS functions and conditional terms changes to the coloring for data/proc statement options to make room for the use of red for errors. "Note" prefixes are blue, "Warning" are green and "Error" are red. Additionally numerics have been darkened and bolded to help the line numbers stand out.

Next Section Previous Section

Copyright © 2000- , Martin Works Inc., Text, graphics, and HTML code are protected by US and International Copyright Laws, and may not be copied, reprinted, published, translated, hosted, or otherwise distributed by any means without explicit permission. SAS® is a registered trademark of SAS Institute, Inc. in Cary, NC. Multi-Edit® is a trademark of Multi-Edit Software Inc. All other logos and trademarks in this site are property of their respective owners.