Define abbreviations in the SAS enhanced editor

8

Did you know that you can define "abbreviations" in the SAS enhanced editor? These handy little shortcuts can save you a lot of typing. For example, I have an abbreviation for the string _iml. Whenever I type _iml, the editor prompts me to replace those four characters with the following SAS/IML template:

proc iml;
use <dataset>;
read all var {A B};
close;
 
quit;

I can also define a keystroke that inserts the abbreviation. For example, I can define CTRL+I to insert the preceding code snippet.

To learn more about defining abbreviations in the SAS enhanced editor, see the paper "SAS Abbreviations are your friends, use the template method to code!" by Elizabeth Ceranowski. A paper by Mary Rosenbloom and Kirk Paul Lafler describes how to assign your abbreviation to a function key.

Share

About Author

Rick Wicklin

Distinguished Researcher in Computational Statistics

Rick Wicklin, PhD, is a distinguished researcher in computational statistics at SAS and is a principal developer of SAS/IML software. His areas of expertise include computational statistics, simulation, statistical graphics, and modern methods in statistical data analysis. Rick is author of the books Statistical Programming with SAS/IML Software and Simulating Data with SAS.

8 Comments

  1. This will be very handy. Another useful shortcut can be used to comment / uncomment a few lines of code. Highlight the lines of code, and press CTR+/ to comment or CTRL+SHIFT+/ to uncomment.

    • This comment/uncomment shortcut would be very handy indeed. Any idea how to implement this? I suppose it's a bit more complicated than inserting a piece of code...

      • Rick Wicklin

        It's already implemented. The SAS Enhanced editor has a number of keyboard shortcuts built in, and CTRL+/ and CTRL+SHIFT+/ are just two of them.

        To see all the pre-defined keyboard shortcuts, bring up the SAS Windowing Environment (formerly known as SAS Display Manager). Select Tools-->Keyboard Macros-->Macros. Click Assign Keys. This brings up the Assign Keys dialog box.

        If you choose "Selection Operations" from the Categories menu, you will see the comment/uncomment commands, and the keys that they are currently mapped to. If you choose "All" from the Categories menu, you can se all options and key bindings.

        This is all pretty well hidden, don't you think?

  2. Pingback: Abbreviation for GTL boiler plate

  3. Pingback: This week in blogs: abbreviations, innovation and the holidays - SAS Voices

  4. Pingback: Take SAS program editor abbreviations to the next level - The SAS Dummy

Leave A Reply

Back to Top