Sunday, October 14, 2012

New Sublime Text package available for SAS Programming

Please use my SAS Package for Sublime Text

I started writing a crazy long treatise on why I like text editors, but really the information I want to put out is this: I've been working on a package for SAS programming with the Sublime Text 3 editor, which I believe is really functional & I would love to get feedback on how to make it better.

I'm using this as my main editor now--have not opened up UltraEdit in literally weeks and could not be happier.


You will find the package in this github repository.  Installing it amounts to causing the files in that repo to be copied to a new subdirectory under the location where Sublime Text is putting your packages (which you can find out by choosing the 'Browse Packages...' item off the 'Preferences' menu).  There are 2 good ways to do this:

If you've got git

Open a command prompt, cd over to the location where your Sublime packages are stored, and type:
git clone SAS
The nice thing about doing it that way is that you can update the repo anytime thereafter with a simple
git pull
In the package subdirectory.

If you don't have git

The easiest thing would be to download this zip file and extract it to a new SAS subdirectory that you create in your Packages directory.

What do I get?  What's working?

The package includes:
  1. A mostly written-from-scratch SAS program syntax definition file, so syntax highlighting works (including SAS' wonky comment style) and the symbol list gets populated w/dataset & macro names.
  2. Likewise, a SAS log syntax definition file, which highlights NOTEs, INFO messages and of course ERRORs.
  3. A build system (windows-only at the moment) which:
    1. Batch-submits the currently-showing file,
    2. Waits for the program to finish,
    3. Scans the resulting .log file for errors/warnings w/a fairly sophisticated regex (which e.g., ignores license expiration WARNINGs), popping a dialog indicating whether the log is clean), and then
    4. Opens the log file for viewing.
  4. A command to skim through log files, jumping right to ERRORs and WARNINGs, by default bound to ctrl-e.  So just skip from trouble spot to trouble spot by hitting ctrl-e!
  5. A bunch of very useful snippets.

What's not working yet or is still to be done?

My to-do is:
  1. Rewrite the build script (currently a windows script file) as a python command to make it portable across platforms. SORT OF DONE
  2. Incorporate this package into Package Control , to make installation & updating that much easier.
  3. Move the Roy- and Group Health-specific snippets out of the package & into my User package.
  4. Moar snippetts!


Many many thanks to Jiangtang Hu, whose fork of Jakob Stoeck's SAS bundle was the beginning of my hope that I could profitably use Sublime Text for SAS programming!


Looks like there have been late comments to this post, with error reports.  Terribly sorry not to reply--I did not get notification about the comments.

Would anyone who's having trouble please log an issue at the github repository please?

Also--please note that I am no longer supporting sublime text 2 (even though it's nominally the current version).  ST3 has been out for more than a year (?) now, is very stable, and that's all I have installed anywhere, so I'm not in a good position to support ST2.  Sorry!

Thank you!