Tuesday 23 August 2011

NOTE: Keyboard Shortcuts in the SAS Enhanced Editor

I was recently looking at a long piece of macro code where each level of indentation only used one space. It was very difficult to see where some of the %do / %end blocks began or ended. I was reminded that there's a keyboard shortcut for jumping between matching do / end blocks, so I hunted-down the complete list of shortcuts for use in the Enhanced Editor.

Sadly, I didn't find the ability to skip between matching %do / %end (it only works for non-macro do / end blocks)!! but I was reminded of Alt+[ for moving between matching do / end, and ctrl+[ for moving between matching brackets. PLUS, not spotted before, I found the ability to use F2 to add one or more (non-permanent) line markers that you can then use F2 (or shift+F2) to quickly jump to. Surely this is very useful for working on two disparate areas of a large piece of code and repeatedly jumping between them (or three, or more).

Looking over the whole list of shortcuts, it's probably not strictly necessary to document the fact that pressing the Enter key will "insert a carriage return"! But it's probably better to have too much documentation than too little.

I use ctrl+home and ctrl+end a lot in very many Windows apps to get to the top and bottom of a file. And I use ctrl+f in many Windows apps to give me the find dialog too.

Finally, I was surprised to find shortcuts for recording and playing macros. Very useful for doing repeated editing of your code. I seem to recall this was available throughout Windows but I don't see it any more. My thanks to SAS for retaining its availability.