Home of the SAS editor
SAS editing tool
Support for your SAS toolkit
Tools for SAS programming
SAS editor for the new millenium SAS tool, toolkit or IDE buy it today

Templates make SAS coding easy

Conventions
Buttons
Menu Items
Litterals
Templates
Selected text
Cusrsor |

Templates allow you to insert complex language structures or Data and Proc steps into your code by only typing a few characters. See a list of SAS Templates that come with EZRTools.

Also: Power Templates, code with a click Run SAS from editor, see results in editor Syntax coloring, smart indenting
Click on image below to stop animation
Templates create code fast
Automatic template expansion in action. EZRTools comes with hundreds of templates for functions, procs, control structures and much more.

Templates are the Multi-Edit term for "those dear little things that save me so much typing and looking up of passed value orders for functions". This feature is similar to the MASK function for ISPF and the abbreviation list for VI. It allows you to type a few characters (keyword) to generate syntactically correct code with "fill in the blank" areas. Templates (other than smart templates) expand with the same capitalization as that of the keyword you typed.

The templates contain text surrounded in the "back leaning" quote mark. These represent code pieces that must be entered to suit the specific requirements for this location. They are called field strings. You can use Cntl-i to hop to the next field string beyond the cursor. When you do this the enclosed text and the back-quotes are highlighted. This means you just type the actual value and the quoted "hint" is replaced. This is a very quick way to fill in a structure or function call without having to look up function parameter order. No use of arrow keys required. Of course, you can change Cntl-i to any key combo you want through Tools-Customize-Keys/Commands .

Find a page Fast


Language Structures

All of the SAS language structures are covered. If you typed the Keyword: ifed followed by a space, the following code would be inserted in its place.

if `condition` then do;
  `statement`;
end;/*if*/
else do;
  `statement`;
end;/*else*/

If you typed the Keyword: dot followed by a space, the following code would be inserted in its place.

do `var` = `start` to `end`;
  `statement`
end;/*loop*/
 

Back to top

 

Procs and Functions

Commonly Used Procs

Templates exist for most commonly used procs, with the most common sub statements, options etc. represented. You can invoke the template by typing a "p" followed by the name of the procedure followed by a space. For instance, if you typed pappend followed by a blank, you would get the following expansion. The out= value will be selected so that you may immediately overtype it. As always, you can hop to the next parameter using Cntl-i. The spell proc has 2 forms pspell and pspelld for dictionary modification.

proc append out=`sas-dataset` data=`sas-dataset` ``;
run; /*append*/

Functions

A complete set of templates for SAS functions are provided with EZRTools;). You invoke a function template by typing the name of the function, followed by an open parenthesis, followed by a blank. If you typed dhms( the following code is created. The first parameter will be selected, ready to be replaced by typing.

dhms(`date`,`hour`,`minute`,`second`)   
 

Back to top

 

Documentation and Debugging

When EZRTools;) places comments in your code the comments begin beyond colum 4 so that they do not effect the SAS code being inserted into JCL.

Debugging

Debug Put All

Invoked by typing dputa followed by a space at the end of the line that you are interested in. The following sets of statements show the result from the template expansion. Note that the line that the template was expanded on plus it's line number (272 in the first example) are included in the debug output. The inclusion of the word "debug" allows these temporary statements to be easily found in the code (to remove when fixed or comment out ). The inclusion of *DBE allows the collapse tools for log files to identify the complete contents of debug put generated output. In the log output you can hide everything but your debug statements. See "Sub-setting the Log" for more information on hiding lines in the log file.

Before:
retain state city county country "USA"
    salu "Mr." firstn lastn mi |
    active 0 calls cmonth cyear
    expen salry ;

 
After:
retain state city county country "USA"
    salu "Mr." firstn lastn mi
    active 0 calls cmonth cyear
    expen salry ;
    PUT 'Debug after: 272 : salu "Mr." first... <<<<<<<<<<<<<<' /
    _ALL_' *DBE' / ;


Before:
retain state city county country "USA" dput|
    salu "Mr." firstn lastn mi
    active 0 calls cmonth cyear
    expen salry ;

 
After:
retain state city county country "USA"
    salu "Mr." firstn lastn mi
    active 0 calls cmonth cyear
    expen salry ;
PUT 'Debug after: 271 : retain state cit... <<<<<<<<<<<<<<' /
_ALL_' *DBE' / ;


Debug Put Variables

This variation is invoked after first selecting one or more variables or lines. You can then select Tools-Insert Debug Statement from the context sensitive menu (right click in edit area) or press Cntl-Shift-d. The tool will identify variable names that are not the same as a SAS keywords or function names. The following sets of statements show various results from the different uses of this tool. Note that the highlighted line plus it's line number (272 in the first example) are included in the debug output. The inclusion of the word "debug" allows these temporary statements to be easily found in the code (to remove when fixed or comment out). The inclusion of *DBE allows the collapse tools for log files to identify the complete contents of debug put generated output. In the log you can hide everything but your debug statements. See "Sub-setting the Log" later in this document for more information on hiding lines in the log file.

Before:
retain state city county country "USA"
    salu "Mr." firstn lastn mi
    active 0 calls cmonth cyear
    expen salry ;
After:
retain state city county country "USA"
    salu "Mr." firstn lastn mi
    active 0 calls cmonth cyear
    expen salry ;
    PUT 'Debug after: 272 : salu "Mr." first... <<<<<<<<<<<<<<' /
        salu=
        firstn=
        lastn=
        mi=
        ' *DBE' / ;
Before:
   do i = 1 to 100 by 5;
     old = x;
     x = new;
     new = offset + i;
   end;/*do loop*/

After:
   do i = 1 to 100 by 5;
     old = x;
     x = new;
     new = offset + i;
   end;/*do loop*/
   PUT 'Debug after: 297 : end;/*do loop*/ <<<<<<<<<<<<<<' /
       i=
       old=
       x=
       new=
       offset=
       ' *DBE' / ;

Documentation

Prolog

This template produces a prolog that can contain program and maintenance information. When you expand the template you are prompted for a program name and a description. These are fitted into the top section of the prolog. The middle section contains user information from the Programmer_Name and Company_Name templates plus copyright information based on the current system date. The bottom section is set up to hold update, bug fix and other maintenance information (see the maint template below). An example follows.

/******************************************************************/
/******************************************************************/
/***  Program Name: Hasher                                       **/
/**                                                              **/
/******************************************************************/
/*** Description: My wonder full program that hashes everything ***/
/*** until it is broken.                                        ***/
/******************************************************************/
/***                                                             **/
/***                                                             **/
/***                                                             **/
/*** Created: 02/28/2000 3:47:15PM                               **/
/*** By: Art Bitt                                                **/
/*** Copyright c2000 Basement Software All rights reserved.      **/
/***                                                             **/
/******************************************************************/
/*** Maintenance Notes                                           **/
/*** Name                  Date          Time       Change Code  **/
/******************************************************************/
/******************************************************************/ 

Maint

This template adds records to the maintenance section of the prolog. Place your cursor after the comment symbol at the end of the last maintenance line. Press enter and type maint followed by a space. You will be prompted for a reason for the change and maintenance or change code. The programmer name and date are automatically filled in as in the prolog. An example of what is inserted below.

Before:
/***                                                             **/
/******************************************************************/
/*** Maintenance Notes                                           **/
/*** Name                  Date          Time       Change Code  **/
maint |
/******************************************************************/
/******************************************************************/ 
After:
/***                                                             **/
/******************************************************************/
/*** Maintenance Notes                                           **/
/*** Name                  Date          Time       Change Code  **/
/*** Art Bitt           02/28/2000     3:48:29PM       000000    **/
/***   Broken what-ja-ma-callit.                                 **/
/******************************************************************/
/******************************************************************/ 

End of line comments

You can place comments after a code statement very easily with the end of line comments ComEndOfLine and ComEOLDate. The ComEndOfLine , invoked with /* followed by a blank at the end of line, tabs right once and places the text /* */ on the line. Your cursor is placed one space after the /* characters. The ComEOLDate template works the same except it puts a Date/Time stamp at the end of the comment. It is invoked with the characters /*d followed by a blank. Examples of both templates are listed below.

Before:
  w= log(x); /* |
After:
 w= log(x);    /* | */ 
Before:
 r= w + 1; /*d |   
After:
 r= w + 1;     /* |  04/05/00 12:03:PM */
 

Back to top

 

Help Templates

Help templates are set up to provide code expansion that contains all the options for the statement in question. Often the code is accompanied by comments with further information. They may expand to multiple calls of the item in each of the major flavors. This form allows you to delete the unwanted flavors/comments. The following topics have help templates available. Help templates are invoked by using the name of the statement preceded with a ? mark.

  • System Options (?system)
  • Dataset Options (?dataset)
  • Libname
  • Label
  • Infile
  • Filename
  • File
  • By
  • Array

Below are a few examples of the code that results from help template expansion

For ?libname:
LIBNAME `LIBREF` '`SAS-DATA-LIBRARY`' <HOST-OPTIONS>;
LIBNAME `LIBREF` CLEAR;  /*DISASSOCIATE*/
LIBNAME `LIBREF` |_ALL_ LIST;  /*LIST ATTRIBUTE, PRINT TO LOG */
For ?dataset:
(COMPRESS=`NO|YES`
    DROP=`VARIABLE-LIST`
    FIRSTOBS=`N`
    IN=`VARIABLE`
    INDEX=`INDEX``<=VARIABLE-LIST>` `</UNIQUE>` `</NOMISS>` `<...>`
    KEEP=`VARIABLE-LIST`
    LABEL=`LABEL`
    OBS=`N`
    RENAME=(`OLD-NAME1`=`NEW-NAME1` `<...>`)
    WHERE=(`WHERE-EXPRESSION`)
    );
 

Back to top

 

Jump to: Editing features, Templates, SAS Integration and Debugging and Smart Code. Or, look at the EZRTools;) manual.

 

Download a trial copy of EZRTools;)

Download a trial version of Multi-Edit.



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.

50 Myrtle Street, Susquehanna, PA 18847 570-396-3121




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.