[ESS-bugs] Error in ess-sas-submit-region

Wilmar Igl wilmar.igl at ki.se
Thu Oct 11 13:30:49 CEST 2007


Hi, folks!

The variable <ess-sas-submit-command-options> has been missing in the 
<ess-sas-submit-region> function. The corrected syntax goes like this:

;;;;;;;;;;;;;;;;;;;;;essa-sas.el (ll. 971-996);;;;;;;;;;;;;;;;;;;;;;;;

(defun ess-sas-submit-region ()
     "Write region to temporary file, and submit to SAS."
     (interactive)
     (ess-sas-file-path)
     (write-region (region-beginning) (region-end)
	(concat (ess-sas-temp-root) ".sas"))

     (save-excursion
       (ess-sas-goto-shell t)

     (if (and (w32-shell-dos-semantics)
	(string-equal ":" (substring ess-sas-file-path 1 2)))
	(progn
		(insert (substring ess-sas-file-path 0 2))
		(comint-send-input)
     ))

     (insert "cd \"" (convert-standard-filename
	(file-name-directory ess-sas-file-path)) "\"")
     (comint-send-input)

     (insert (concat ess-sas-submit-pre-command " " ess-sas-submit-command
           " " ess-sas-submit-command-options " " (ess-sas-temp-root) " 
" ess-sas-submit-post-command)) ;; WI-2007-10-11
     (comint-send-input)
     )
)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Just inserted <ess-sas-submit-command-options " "> in the line with the 
comment <;; WI-2007-10-11>. I've tested it and it works.

The error leads to incompatibilities (SAS error messages) if you use the 
functions <ess-sas-submit-region> and <ess-sas-data-view-fsview-command> 
, as they require different options in the in the function 
<ess-sas-submit-command>.

To make the information complete:
I am working under Windows XP, SAS 9.1.3 for Windows and GNU Emacs 
22.0.99.1 (i386-mingw-nt5.1.2600) of 2007-04-24 on LENNART-69DE564 
(patched).

My .emacs (extract):
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(message ";; Emacs speaks Statistics (ESS)")

(require 'ess-site)

;;  ESS: SAS-Mode

(require 'essa-sas)
(setq ess-sas-global-pc-keys t)

(setq-default ess-sas-submit-command "sas.exe -autoexec 
\"z:\\00_Preferences\\SAS\\autoexec_batch.sas\" -batch -pageno 1 -nosplash")
(setq-default ess-sas-submit-command-options "-sysin")
(setq-default ess-sas-data-view-submit-options "-nosysin -print NUL: 
-log NUL:")
(setq-default ess-sas-submit-method  'sh)

(defun ess-sas-3window ()
"Put running SAS buffers into three windows in one frame.
Place the cursor in a myfile.sas buffer.  Run SAS in Batch mode,
Return the cursor to the myfile.sas buffer, then enter C-c 3 to
put myfile.sas in the upperleft window, myfile.log in the
upperright window, and myfile.lst buffers in the bottom window.
The SAS Shell buffer remains buried."
   (interactive)
   (delete-other-windows)
   (split-window-vertically)
   (split-window-horizontally)
   (setq sas-file-name (buffer-name))
   (find-file (concat (substring sas-file-name 0 -4) '"-temp.sas"))
   (other-window 1)
   (find-file (concat (substring sas-file-name 0 -4) '"-temp.log"))
   (setq buffer-read-only t)
   (other-window 1)
   (find-file (concat (substring sas-file-name 0 -4) '"-temp.lst"))
   (setq buffer-read-only t)
   (other-window 1)
)

(add-hook 'sas-mode-hook
(global-auto-revert-mode t)
(setq ess-sas-temp-root "-temp")
)

(define-key ess-mode-map [(control ?c) (?3)]         'ess-sas-3window)
(define-key ess-mode-map [(control ?c) (control ?b)] 'ess-sas-submit)
(define-key ess-mode-map [(control ?c) (control ?r)] 'ess-sas-submit-region)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

I hope you can make using ESS under Windows with SAS more user-friendly 
in the future.

Thank you for your effort developing ESS,

Wilmar

-- 
Wilmar IGL (Mr.)
PhD, Psychologist

Department of Medical Epidemiology and Biostatistics
Karolinska Institutet
-Visiting address: Nobelsväg 12 A, Room 5427
-Postal address: P. O. Box 281
SE-171 77 Stockholm
Sweden

Phone: +46 (0) 8 5248 7484
VoIP: wilmar.igl (Skype)
E-mail: wilmar.igl[AT]ki.se
Internet: http://ki.se/meb



More information about the ESS-bugs mailing list