Chapter Contents |
Previous |
Next |
SAS Companion for the Microsoft Windows Environment |
The Enhanced Editor is an ASCII editor that uses visual aides to help you write and debug your SAS programs.
Select one of the following links for more information:
Enhanced Editor Features |
The Enhanced Editor includes many of the features from the Program Editor in addition to the following:
Opening Files |
To open a new file, select
View | Enhanced Editor |
Alternatively, you can open new files using the New toolbar button, the File menu, or the WEDIT command. For more infomation about the WEDIT command, see WEDIT.
To open an existing file, make an existing Enhanced Editor window the active window and do the following:
To append a file to the bottom of an opened file:
File | Append... |
Saving Files |
An asterisk ( * ) that appears in an Enhanced Editor window title bar indicates that the editor contains text that has not been saved to disk. Enhanced Editor windows that display 'Untitledx' in the title bar are new files that have never been saved. The x indicates a window number.
To save the contents of the Enhanced Editor window, click on the Save toolbar button (the diskette). If the file is to be saved for the first time, the Save As dialog box will open for you to name the file and folder.
To save a file with a new name, select
File | Save As |
Checking for Coding Errors |
By color coding program components, the Enhanced Editor can help you check for errors such as misspelled keywords and unmatched quotes and comments. For information on defining colors for program components, see Setting Appearance Options.
For example, if you define the undefinded keyword foreground color to black, the undefined keyword background color to gray, and the keyword color to blue, the Enhanced Editor would change a keyword to blue when it is entered correctly. As the first word in a statement is a SAS keyword, you could recognize misspelled keywords instantly by the black text on a gray background at the beginning of a line.
In Filename Statement with a Missing Quotation Mark, you can see that unmatched quotation marks for strings are easily spotted as the text remains the same color until the string is closed with a matching quotation mark. In this example, all text after the open quotation mark is red. The comments following the filename statement are red also as the string was never closed. Looking for Errors in the Enhanced Editor shows that once the string is closed, the string remains red and the comments have been defined as green.
As with strings, all text that follows the open comment symbol /* remains the same color until the Enhanced Editor recognizes an ending comment symbol */.
To check for unmatched parenthesis or brackets, place the cursor before a parenthesis or bracket and press Ctrl + ]. If one is not found, the cursor does not move.
Filename Statement with a Missing Quotation Mark
Looking for Errors in the Enhanced Editor
Using the Enhanced Editor Window |
This section explains the many functions available to you in the Enhanced Editor window.
When the Enhanced Editor opens a new file, the title bar of the Enhanced Editor window contains the Enhanced Editor icon (as shown in Enhanced Editor Icon) and the text 'Untitledx', where x is a window number.
Once you start entering text, the title bar displays an asterisk ( * ) which indicates that changes have been made to the file and the changes have not been saved to disk. Once you save the file, the file name displays in the title bar and the asterisk disappears until you start entering additional text.
The margin on the left side of the Enhanced Editor window is used to
select lines of text, expand and collapse code sections, and display line
numbers, code section brackets, and bookmarks.
The Enhanced Editor has numerous key sequences for moving the cursor, as shown in Key Sequences for Moving the Cursor.
To go to a specific line, use the Go To Line dialog box:
By default, when you click the mouse button past the end of a line, the cursor is placed after the last character in a line.
To enable the Enhanced Editor for placing the cursor past the end of a line:
Tools | Options | Enhanced Editor... | General |
Use Key Sequence... | To Move the Cursor.... |
---|---|
Up arrow | up one line |
Down arrow | down one line |
Left arrow | left one character |
Right arrow | right one character |
Page Down | down a page |
Page Up | up a page |
Home | to the beginning of the current line |
Ctrl + Home | to the beginning of the document |
End | to the end of the current line |
Ctrl + End | to the end of the document |
Ctrl + up arrow | towards the top of the file while scrolling up |
Ctrl + down arrow | towards the bottom of the file while scrolling down |
Ctrl + right arrow | to the start of the next word |
Ctrl + left arrow | to the start of the previous word |
Ctrl + ] | to the matching parenthesis or bracket |
Ctrl + G | to a specific line number |
Alt + up arrow | to the first visible line |
Alt + down arrow | to the last visible line |
Alt + up arrow | to the first visible line |
Alt + right arrow | to the next case change or word boundary |
Alt + left arrow | to the previous case change or word boundary |
Shift + Tab | backwards to the previous tab stop |
To select one or more lines of text using the margin:
Selected text is marked in reverse video.
You can also select single or multiple characters, or whole lines of text when you:
Keyboard shortcuts are also available to select text. To extend a selection in a particular direction, press the Shift key and then a directional arrow. Pressing Shift + left arrow or right arrow will select one character at a time. Pressing Shift + up arrow or down arrow will select one line at a time. For a complete list of selection keyboard shortcuts, see the Selection category in Keyboard Shortcuts within the Enhanced Editor.
To unmark selected text, press any directional key.
To copy selected text, press Ctrl + C or select
Edit | Copy |
To cut selected text, press Ctrl + X or select
Edit | Cut |
To paste from the clipboard, press Ctrl + V or select
Edit | Paste |
To move selected text:
Copying or cutting text places the text in the Windows clipboard. If you select text and then delete the text using the Delete key, the deleted text is not placed in the clipboard.
Text from the clipboard is pasted to the area you indicate. If there is already an area of selected text within the target window, the selected text is replaced with contents of the clipboard.
Note: In addition to
using commands from the Edit menu, editing commands are available from the
pop-up menu when you click the right mouse button in the Enhanced Editor window.
To move or copy text using drag and drop:
To disable drag and drop editing::
Tools | Options | Enhanced Editor... | General |
To find text:
Edit | Find... |
To find and replace text
Edit | Replace... |
When you press the Enter key, you automatically indent the next line by the amount of space the current line is indented. If you prefer not to use automatic indentation:
Tools | Options | Enhanced Editor | General |
In addition to automatic indenting, you can indent using the tab key. Pressing the Tab key moves the cursor and any text to the right of the cursor by the amount of space specified in the Tab size: field of the Enhanced Editor Options dialog box. If you want to insert spaces instead of tab characters when you press the Tab key, select the Insert spaces for tabs check box.
Note: Changing the tab size will modify tab settings to the
new value
in all Enhanced Editor windows.
When you bookmark a line, you create a line marker that is used to easily access that line. A vertical rectangle in the margin indicates that the line is bookmarked. Keyboard Shortcuts for Bookmarking Lines shows the keyboard shortcuts you can use with bookmarking.
To... | Press... |
Bookmark a line | Crtl + F2 on an unmarked line |
Unmark a line | Ctrl + F2 on a marked line |
Go to the next bookmark | F2 |
Go to the previous bookmark | Shift + F2 |
You can define a character string which when entered and followed by the Tab key or the Enter key will expand to a longer character string. For example, you could define the abbreviation myv6sasfiles, which would expand to 'c:\winnt\profiles\myid\personal\mysasfiles\v6';. Abbreviations are actually macros whose task is to insert one or more lines of text.
To create an abbreviation
Tools | Add Abbreviation... |
To use an abbreviation, type the abbreviation. When an abbreviation is recognized, a tooltip displays the expanded text. Press the Tab key or Enter key to accept the abbreviation.
To modify an abbreviation:
Tools | Keyboard Macros | Macros... |
To delete an abbreviation:
Tools | Keyboard Macros | Macros... |
To submit your program, do one of the following:
Run | Submit |
The Enhanced Editor Options dialog box provides the Clear
text on submit setting for you to specify whether or not you
would like the contents of the Enhanced Editor window cleared after submitting
your program. If you would like your program to remain in the editor window,
be sure not to select this option. For more information, see Setting Enhanced Editor Options.
The Enhanced Editor provides extensive keyboard mappings for the Enhanced Editor. Keyboard Shortcuts within the Enhanced Editor provides a complete list of commands and their default keyboard shortcuts.
Some of the more useful default keyboard mappings include:
Add a new abbreviation | CTRL + Shift + A |
Toggle expand current line | Alt + Num * |
Collapse all code sections | Alt + Ctrl + Number pad- |
Expand all code sections | Alt + Ctrl + Number pad + |
Toggle marker on the current line | Ctrl + F2 |
Go to the next marked line | F2 |
Go to the previous marked line | Shift + F2 |
Go to line | Ctrl + G |
Convert selected text to uppercase | Ctrl + Shift + U |
Convert selected text to lowercase | Ctrl + Shift +L |
For information on defining keyboard shortcuts, see
Customizing the Enhanced Editor Keyboard. For a complete list
of keyboard shortcuts, see Keyboard Shortcuts within the Enhanced Editor.
A keyboard macro is a series of Enhanced Editor commands and instructions that you group together as a single command to accomplish a task automatically. Instead of manually performing a series of time-consuming, repetitive actions, you can create and run a single macro. You run a macro from the Tools menu or by using a keyboard shortcut. For information on defining a keyboard shortcut for using macros, see Customizing the Enhanced Editor Keyboard.
You can create a macro by recording it from the Enhanced Editor window:
Tools | Keyboard Macros | Record New Macro |
Tools | Keyboard Macros | Stop Recording |
An alternative way to create a macro is to add commands using the Create Keyboard Macro dialog box. To do this:
Tools | Keyboard Macros | Macros... |
To add a command, select the command from the Commands: list box and click on the double right-directional button. Repeat this step until all commands are listed in the Keyboard macro contents: list box.
You can reorder commands by selecting the command in the Keyboard macro contents: list box and clicking on up or down directional button.
To delete a command, select the command and click on [Delete].
To play a macro, use a keyboard shortcut or :
Tools | Keyboard Macros | Run Macro... |
To edit a macro:
Tools | Keyboard Macros | Macros... |
To modify a command, first be sure you can modify the command by selecting the command from the Keyboard macro contents list box. If a command can be modified, the [Modify] button is active. Click on [Modify] to open a dialog box which will enable you to modify the command.
To delete a command, select the command in the Keyboard macro contents list box and click on [Delete].
To reorder a command, select the command and click on the up or down directional button.
To delete a macro,
Tools | Keyboard Macros | Macros... |
This example lists the steps to create an RSUBMIT statement, an ENDRSUBMIT statement, a blank line between these statements, and tabs in by the amount specified Tabs size: field in the Enhanced Editor Options dialog box.
View | Enhanced Editor |
Tools | Keyboard Macros | Record New Macro |
rsubmit;
endrsubmit;
Tools | Keyboard Macros | Stop Recording |
The resulting macro contains the following commands:
Insert carriage return Insert character ['r'] Insert character ['s'] Insert character ['u'] Insert character ['b'] Insert character ['m'] Insert character ['i'] Insert character ['t'] Insert character [';'] Insert carriage return Insert carriage return Insert character ['e'] Insert character ['n'] Insert character ['d'] Insert character ['r'] Insert character ['s'] Insert character ['u'] Insert character ['b'] Insert character ['m'] Insert character ['i'] Insert character ['t'] Insert character [';'] Move cursor up Insert character ['|']
Keyboard macros can be shard by multiple users by importing or exporting them to or from a folder using the Keyboard Macros dialog box. To open the Keyboard Macros dialog box, select
Tools | Keyboard Macros | Macros... |
To import a keyboard macro, click on [Import], select a folder from the Look in: drop-down list box and a filename from the list box. Then click on [OK].
To export a keyboard macro, click on [Export], select
a folder from the Look in: field, type a file name
in the File name: field, and click on [OK].
Collapsible code sections, when enabled, allows you to expand or collapse one or more sections of code. Refer to The Enhanced Editor When Collapsible Code Segments Are Enabled to see the expand and collapse controls, and the brackets and lines that delineate code sections.
A section begins with a section word, a comment, or spaces above a section word or comment. A section ends with the next section keyword, a comment, or space above the next section word or comment. Section words include the DATA statement, the PROC statement, and the %MACRO statement. The signature line is the line in which the section word appears.
An expanded section is indicated by the [-] control in the margin at the signature line. To collapse a section, click on [-].
A collapsed section is indicated by the [+] control in the margin and the signature line is the only line of code that is displayed. To expand a section, click on [+] in the margin.
The Enhanced Editor When Collapsible Code Segments Are Enabled
Brackets in the margin and a section line across the editor window mark the beginning and ending of a section. If you don't want to see the brackets or the section line, you can turn them off using the Enhanced Editor dialog box.
To disable collapsible code sections, or brackets and lines, select
Tools | Options | Enhanced Editor... | General |
The following rules apply when you are selecting and editing collapsed segments:
Setting Enhanced Editor Options |
You can customize how the Enhanced Editor works for you by using the Editor Options dialog box, as shown in Editor Options Dialog Box.
.
To open the Editor Options window from the menu, be sure an Enhanced Editor window is the active window and select
Tools | Options | Enhanced Editor... |
Click on the tabs that are located along the top of the dialog box to navigate to the settings that you want to change, and then select the options you want. When you are finished, click on [OK].
The following sections describe the pages (or tabs) of the Editor Options
dialog box and how to set the formatting options.
The General page lets you specify the general options that control how the Enhanced Editor works. The following are the General options:
The Appearance options let you specify foregound and background colors, and font styles for SAS program elements. You can also create and save color schemes. For more information on using these appearance options, see Setting Appearance Options and Using Schemes. The following are the Appearance options:
When you set appearance options, you set them for the elements of the file type specified in the File type: drop-down list. As you make your selections, the Sample box displays your selected formatting. The formatting options that you specify are applied to all opened Enhanced Editor windows of that file type. When you start the SAS System, the formatting options that are applied to the Enhanced Editor files are the formatting options that were in effect when the SAS System last ended.
To specify appearance options:
Tools | Options | Enhanced Editor... | Appearance |
A scheme is a saved set of formatting options. After creating a scheme, you can set Enhanced Editor appearance options by selecing only a file type and a scheme. Using a scheme saves you from setting each individual file element.
To create a scheme:
To modify a scheme:
To delete a scheme:
Customizing the Enhanced Editor Keyboard |
You can customize Enhanced Editor commands and keyboard macros using the Enhanced Editor Keys dialog box.
When you open Enhanced Editor Keys dialog box, you can view only commands that have assigned keyboard shortcuts, or you can view all commands. To see only the commands with assigned keyboard shortcuts, be sure that the Show all commands check box is not selected. To see all commands, including those that have no key assignment, check the Show all commands check box.
To assign keyboard shortcuts:
Tools | Options | Enhanced Editor Keys |
Note: Assigning a keyboard
shortcut to a key sequence that is assigned to
another command will delete the shortcut for that command. For example, if
you assign the Backspace key to the Add a new abbreviation
command, pressing the Backspace key displays the Add Abbreviation dialog box
and you can no longer backspace using the Backspace key.
To delete a keyboard shortcut:
Tools | Options | Enhanced Editor Keys |
Resetting keyboard shortcuts to the default keyboard shortcuts will delete all macro keyboard shortcuts. See Keyboard Shortcuts within the Enhanced Editor for a list of the default keyboard shortcuts.
To reset keyboard shortcuts to the Enhanced Editor default keyboard shortcuts:
Tools | Options | Enhanced Editor Keys |
Enabling and Disabling the Enhanced Editor |
By default, the Enhanced Editor is enabled when you start the SAS System. To disable the Enhanced Editor when you start the SAS System, use the NOENHANCEDEDITOR system option. For more information about the NOENHANCEDEDITOR system option, see ENHANCEDEDITOR. You can also enable or disable the Enhanced Editor using the Use Enhanced Editor setting in the Preferences dialog box Edit page or by using the WEDIT command. For more information on the WEDIT command, see WEDIT.
When you disable the Enhanced Editor, Enhanced Editor menu commands are not available. All opened Enhanced Editor windows remain open and you are able to open new Enhanced Editor windows using the View menu or the WEDIT command. If the Enhanced Editor is disabled when you start the SAS System, the Enhanced Editor window will not open.
When the Enhanced Editor is enabled, the Text Editor command in the Tools menu will open an Enhanced Editor window. When the Enhanced Editor is disabled, the Text Editor command opens SAS NOTEPAD.
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.