As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.
Here are some tips for How to share your SAS knowledge with your professional network.
Tips for sas programming with ultraedit
Get the wordfile for SAS syntax highlighting from this page.
If you can't find the UltraEdit >> wordfiles folders where they are supposed to be, create the folders.
You can change the font that UE uses by choosing 'Set Font' off the View menu. You can of course use the fixed font that comes with SAS, but I like ProFont even better--it was created specifically for programming. If you do switch to a font other than SAS monospace, you'll want to add this option to your program header
Doing so also makes your .lst file output nice and paste-able into e-mail messages, which can be handy. See FORMCHAR Option.
Pop the Tool Configuration dialog by choosing Tool Configuration off the Advanced menu.
You can choose anything you like for the menu item name--'sas' seems the obvious choice. The command line is the important part. The basic syntax for a command-line call to sas is:
"<<path to sas.exe>>" -sysin "<<path to yoursasprogram.sas>>"
Note those quote marks in there--you'll need those b/c these path specs may have spaces in them, and windows goes all apoplectic if you don't delimit the path specs w/quotes. The first path can vary from machine to machine (and by version of sas). On my machine it's at "C:\Program Files\SAS\SAS 9.1\sas.exe".
UE can help you out w/that second path spec--the one to the sas program you want to submit. UE has some standard variables you can put on the command line, and it will substitute in various useful things for you when you invoke the command. Click the help button on the dialog for details, but the one we want in this case is %f, which stands for 'the path/filename of the file currently showing in the editor'. So a serviceable command line spec on my machine would be:
"C:\Program Files\SAS\SAS 9.1\sas.exe" -sysin "%f"
(Again--don't forget those quotes around the %f). If you use something like this, you'll probably also want to put "%p" in the Working Directory spec, so that sas will put your .log & .lst files in the same folder where your program is.
One other thing to do on this dialog is to switch over to the Options tab and check the 'Save active file' box. That way UE will automatically save the file you're looking at before submitting it to SAS.
Once you get all that typed out into the dialog, click the 'Insert' button to actually configure the tool.
Once you've done that, you should see an extra entry on your Advanced menu, with a shortcut-key listed:
So now you can submit the currently-showing file to sas just by hitting ctrl-shift-zero.
Even Better Batch-Submission
Note that the above gets you serviceable batch-submission capability. But you can get even better functionality by submitting your currently-showing file to an intermediary script that will:
- submit your program to sas
- wait for sas to finish running your program
- run through the resulting log file, looking for errors/warnings, and
- opening up the .log and .lst files immediately after.
I've written a windows scripting host vbscript that does just this--see code here. To use that, copy the lines of that script into a plain text file with a name that ends in ".wsh", and save it someplace convenient (I've got my copy in my My Documents folder). Then change your command line for the 'sas' tool to:
wscript "<path to the .wsh script>" /sasprog:"%f"
On my system I have:
wscript "C:\Documents and Settings\pardre1\My Documents\WSH\SasWrap.wsf" /sasprog:"%f"
Jump to Problems in your Log File
Here's a UE macro that will find the next error/warning/variable uninitialized note in the currently showing file:
InsertMode ColumnModeOff HexOff PerlReOn Find RegExp "(^error|^warning|uninitialized|remerg)"
I have that assigned to the ctrl-e key combination, so I can bounce from error to error as I review my log files.
Save Code Snippets in 'Templates'
Choose 'Display/Modify Templates' off the Advanced menu to save particularly useful or hard-to-remember snippets of code. Here's one I like to use:
ods html path = "[FILE_PATH]" (URL=NONE) body = "[FILE_NAME].html" ; run ; ods html close ;
When you insert that, UE will substitute the path & name of the currently showing file, so you wind up w/a new ODS output file w/the same name as your sas program, stored in the same folder.