![]() |
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
SAS Editing Features |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
These are powerful features that help you while you are coding. Many are automatic, in that no action on you part is necessary for them to work. Others work by selecting some text and then invoking a macro.
Smart IndentingAs 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. Syntax highlightingThe 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 . 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 . 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.
CommentingThe commenting section includes features that allow you to quickly comment out a block of code, then return it to normal, create block comments, and quickly add prologs and other maintenance information. Comment Un commentYou can comment out a block of code by selecting it with the mouse, and invoke the Comment Un comment menu item from the Comment Block Commands selection of the context sensitive menu. This function can also be invoked by pressing the Com Out button from the SAS toolbar. Any comments within the block of code are altered to prevent them from effecting the commented out block. This conversion is easily removed by using the same function on that block of code again. If you have previously used this function on a block of code, you can remove the comment blocking. The comments will be removed and any contained comments will be returned to their original form. Conversion of a Block of lines with Comment Un comment: data temp2; set temp; if x > 11; /* this is important */ run; After: /***# Comment Out Start **************************
data temp2;
set temp;
if x > 11; \* this is important *\
run;
**************************** Comment Out End #***/
Single Line Block CommentsYou can create a small comment box around a single line with the comment block single line edit macro. You can invoke this macro through the selection off the submenu of the (right click) context sensitive menu. Or you can use template expansion, pressing the button on the SAS toolbar, or by running the macro cbline (SAS^cbline from a non *.sas file). When used through the context sensitive menu or the Macro-Run menu the cursor must be on the line containing the comment. When using template expansion just type cbl followed by a space at the end of the line. The first character on the current line determines where the comment symbol begins if that character is in column 1 through 4. If the first character is beyond column 4, then the comment's first "/" begins 3 positions to the left. This is done to prevent a "/" from occurring in column 1, which would cause problems if the SAS code is included in a JCL stream. A before and after example of the operation is shown below. Before:run;
Sort the new data!|
proc sort data=indata.mystuff;
by var1;
run;
After:run;
/**********************/
/* Sort the new data! */
/**********************/
proc sort data=indata.mystuff;
by var1;
run;
Block CommentsYou can create a comment box around a block of lines with the comment block edit macros. You can invoke these macros through the (right click) context sensitive menu with off the submenu. You can also press the button (or ) on the SAS toolbar. You can also use the template expansion (if you have persistent blocks set on), or by running the macro cbit (SAS^cbit from a non *.sas file), cbit2 or cbit3 . When used through the context sensitive menu or the menu you must have the comment lines selected as a block. All the comment block functions are listed in the sub menu of the context sensitive menu selection . When using template expansion just type cbk followed by a space (or cbk2, cbk3 ) at the end of the selected block. Note, you must have persistent blocks turned on ( menu) to use the template expansion method. The starting position (column) and length of the first line determine where the comment box starts and the total width of the box. The position of the subsequent line is not relevant. All the text in the selected block are word wrapped to fit into the comment box with a blank on the left margin and left justified. Note that all duplicate blanks are eliminated from the selected text before it is fit into the box. A before and after example of the operation is shown below. Before:run;
This is a very critical part
of my overly important program. (I feel that
the usefulness
of
the
program is highly under rated.)
proc sort data=indata.mystuff;
by var1;
run;
After:run;
/*************************/
/* This is a very */
/* critical part of my */
/* overly important */
/* program. (I feel that */
/* the usefulness of the */
/* program is highly */
/* under rated.) */
/*************************/
proc sort data=indata.mystuff;
by var1;
run;
You can create larger blocks by placing more blanks before the last word in the first sentence of the text to be comment blocked. Before:run;
This is a much larger comment block
but is still important
proc sort data=indata.mystuff;
by var1;
run;
After:run;
/**************************************************/
/* This is a much larger comment block but is */
/* still important */
/**************************************************/
proc sort data=indata.mystuff;
by var1;
run;
Quick searchesQuick searches allow you to find, somewhere else in the file, words or phrases that you can highlight on the current line. You can find all occurrences or just the next one up or down in the code. Its as easy as selecting some text and clicking a button. Find Selected ItemThree macros are available to find an item that you have selected. Two of the macros move your cursor to the next or last occurrence of the selected text. The third finds all occurrences and lists them in the Search List (bottom of edit screen). These macros are executed from the context sensitive menu or through key combinations. Find All (Global)Select , press SAS toolbar button , or press Cntl-Shft-m to find all occurrences of the currently selected string. The menu selection is located under the menu item of the SAS context sensitive menu. is located on the primary context sensitive menu while in LOG files. After you invoke the macro all occurrences of the string in the current file are listed in the Search List. You can hop to that line by double clicking it in the Search List. Find Forward (Next)Select , press SAS toolbar button or press Cntl-Shft-n to find the next occurrence of the currently selected string. The menu selection is located under the menu item of the SAS context sensitive menu. is located on the primary context sensitive menu while in LOG files. After you invoke the macro the cursor is moved to the next occurrence of the selected string. The string is highlighted, allowing you to invoke the macro again, or replace the text. Find Backward (Last)Select , press SAS toolbar button or press Cntl-Shft-b to find the prior occurrence of the currently selected string. The menu selection is located under the menu item of the SAS context sensitive menu. is located on the primary context sensitive menu while in LOG files. After you invoke the macro the cursor is moved to the previous occurrence of the selected string. The string is highlighted, allowing you to invoke the macro again, or replace the text. Jump to: Editing features, Templates, SAS Integration and Debugging and Smart Code. Or, look at the EZRTools;) manual. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home : About Us | Links | Site Map | News Releases | Contact Us |
| Support : Tips and Hints | Downloads and Patches | Manual | FAQs | Newsletters | Bug Reports | Suggestions |
| Products : Overview of Features | Features | Screen Shots | Free Trial | Purchase | Lite Version |
EZRTools created by Martin Works, Inc.
312 Myrtle Street, Susquehanna, PA 18847 570-853-0940