Monday, 24 May 2010

NOTE: SAS abbreviations

I'm familiar with little pop-up tips in many development environments for many languages. These tips spot that you're about to type a call to a function (for example) and show you the template syntax for the function. I didn't realise until recently that this was possible in SAS too.

I frequently struggle to remember the parameter order for the TRANWRD function - it seems counter-intuitive to me - but no longer because my abbreviation pops-up a prompt whenever I begin to type TRANWRD.


There's a very good summary page in the R&D area of the SAS web site, so I won't repeat it all here, but save to say SAS abbreviations are available with the SAS Enhanced Editor in the Windows and they allow you to define a character string so that when you type it and then press the TAB key or the ENTER key, the string expands to a longer character string.

Better still, the summary page provides a link to Data Means' web site wherein you will find a file full of abbreviations. This file is in KMF format, i.e. the import/export format for SAS abbreviations.

Importing the abbreviations is very easy. From the Enhanced Editor menu, select tools-> keyboard macros -> macros. This brings up the Keyboard Macros dialog box. Click on Import, navigate to your KMF file, select the file and click OK.

SAS abbreviations can reduce repetitive typing and remind you of your favorite syntax. Give them a try!

[Update: see comments from Chris@SAS regarding EG 4.3]