Usage Note 32774: Creating keyboard macros and keyboard abbreviations in the SAS Enhanced Editor to reduce typing for repetitive code
The SAS Enhanced Editor gives you the option you to create a keyboard macro that contains SAS code and assign it to a key combination. Then, instead of retyping the code, you can use the key combination in any Enhanced Editor window to paste in the associated code. To create a keyboard macro do the following:
- SelectView ► Enhanced Editor (not Program Editor).
- SelectTools ► Keyboard macros ► Record new macro.
- In the Enhanced Editor, type the code you would like to save.
- SelectTools ► Keyboard macros ► Stop Recording.
- Fill in Keyboard Macro Name and Keyboard Macro Description.
- Click OK if you want this on a list of macros OR click Assign keys if you would like to assign a function key or key combination to the macro.
- For key assignment, select the word None under Press new shortcut key. Then click the desired key (or key combination like control-m) on the keyboard. If this key combination has not already been assigned, the following message displays:
Currently assigned to: None
- Click Assign. Click OK.
Now, use the key combination in the Enhanced Editor to activate the keyboard macro.
Alternatively, you can create a keyboard abbreviation, which associates SAS code with letters on the keyboard, instead of key combinations. To accomplish this do the following:
- Select View ► Enhanced Editor (not Program Editor)
- Select Tools ► Add Abbreviation.
- Type in any text in the Abbreviation box , such as DA. Text entered in this box will be case-sensitive.
- Type in any SAS code or comments to associate with the abbreviation in the Text to insert for abbreviation box.
- Click OK.
Now, in the Enhanced Editor when you type in the abbreviation you used to define the shortcut, such as DA in the example above, a window pops up with the text associated with the abbreviation. If you press the ENTER key, the text associated with the abbreviation is automatically placed in the Enhanced Editor. However, if you keep typing instead of pressing ENTER, the window goes away and the text is not inserted.
More detailed instructions are provided in the SAS paper, "SAS Abbreviations are your friends, use the template method to code!"
Operating System and Release Information
| SAS System | Base SAS | Microsoft® Windows® for 64-Bit Itanium-based Systems | | |
| Microsoft Windows Server 2003 Datacenter 64-bit Edition | | |
| Microsoft Windows Server 2003 Enterprise 64-bit Edition | | |
| Microsoft Windows XP 64-bit Edition | | |
| Microsoft® Windows® for x64 | | |
| OS/2 | | |
| Microsoft Windows 95/98 | | |
| Microsoft Windows 2000 Advanced Server | | |
| Microsoft Windows 2000 Datacenter Server | | |
| Microsoft Windows 2000 Server | | |
| Microsoft Windows 2000 Professional | | |
| Microsoft Windows NT Workstation | | |
| Microsoft Windows Server 2003 Datacenter Edition | | |
| Microsoft Windows Server 2003 Enterprise Edition | | |
| Microsoft Windows Server 2003 Standard Edition | | |
| Microsoft Windows XP Professional | | |
| Windows Millennium Edition (Me) | | |
| Windows Vista | | |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
If you have code that you type repeatedly, you can create a keyboard macro or keyboard abbreviation and store the code. Then use the assigned key combination or short text string to insert the repetative code.
| Date Modified: | 2008-08-29 13:37:01 |
| Date Created: | 2008-07-23 16:45:56 |