SAS process under Windows NT

Michael A O Ash mash at
Fri Feb 25 23:25:19 CET 2000

On Fri, 25 Feb 2000, Rich Heiberger wrote:
> [One option] is to run a batch SAS job with the .sas file.  [One way
> to do this] is a newer set of functions that are available in
> essa-sas.el beginning with ESS 5.1.11.  essa-sas.el must be explicitly
> loaded by the user.

This works extremely well, and gives hotkeys to submit the file to sas
[F3] in batch mode and to view the log [F5] and listing [F6] files. It's
really a pleasure after the SAS Windows Manager.  I had to make some small
modifications to essa-sas.el to make this work under Windows NT.  Let me
share those with the group.

essa-sas.el is in the subdirectory ess-5.1.11/lisp/
The relevant changes are in the part of the code that defines the
esas-submit function for which the hotkey is elsewhere defined as [F3].

(defun esas-submit ()
  "Save the .sas file and submit to shell."
  (if (not (string= esas-sas (buffer-name))) (esas-file esas-sas))
  (shell-command (concat "sas " esas-root " &"))
  ;;un-comment the following line for emacs for Windows
  ;;(shell-command (concat "c:\\progra~1\\sas\\sas.exe " esas-root " -nosplash &"))
  (switch-to-buffer esas-sas))

To make this work with emacs under windows NT

1) Comment out the line PRECEDING ";;un-comment ..." because it is for

;  (shell-command (concat "sas " esas-root " &"))

2) Per instructions, uncomment the line with the SAS for Windows command

   (shell-command (concat "c:\\progra~1\\sas\\sas.exe " esas-root " -nosplash &"))

3) I had to make three modifications.  Note that \\ are used in specifying
the path so emacs doesn't think that \ is the escape, and you must be
picky about the spaces.

(a) The SAS executable on my network is i:\sas\sas.exe; so it's on a
different path.  Your SAS executable might be in c:\progra~1\sas\sas.exe
in which case you don't need to change anything.

   (shell-command (concat "i:\\sas\\sas.exe " esas-root " -nosplash &"))

(b) I needed to insert "-sysin" to tell SAS to read my .sas file as
commands for sas:

   (shell-command (concat "i:\\sas\\sas.exe -sysin " esas-root " -nosplash &"))

(c) I needed to insert "-config c:\\sas\\" to make SAS work
properly.  The location of your file might be different.  In
case it gets split by e-mail, note that the next item should all be one

   (shell-command (concat "i:\\sas\\sas.exe -sysin " esas-root " -config c:\\sas\\ -nosplash &"))

After making these changes, you need to load essa-sas.el:
M-x load-file

Note that you need to load essa-sas.el specially, i.e., separately from
ess-site.el You can add the following to your .emacs, where PATH is the
appropriate path: (load-file "PATH/ess-5.1.11/lisp/essa-sas.el")

I am now able to edit a .sas file and hit [F3] to save and submit. The SAS
batch interface tells me that the job is running.  The emacs mini buffer
tells me that the job has either finished or exited with an error message.
And [F5] and [F6] show the log and list files respectively.

This is another great feature of ESS.  Thanks to Rich for pointing it out.


Michael Ash, Assistant Professor
  of Economics and Public Policy             mash at
Department of Economics                    tel 413/545-6329 [off]
University of Massachusetts-Amherst            413/545-2921 [fax]
Amherst, MA 01003  

ess-help mailing list -- To (un)subscribe, send
subscribe	or	unsubscribe
(in the "body", not the subject !)  To: ess-help-request at

More information about the ESS-help mailing list