[ESS] Replace control characters in log

Richard M. Heiberger rmh at temple.edu
Wed Jan 16 11:14:33 CET 2008


I think we have it now.  Add this line to your autoexec.sas

options noovp ;        /* prevents error messages in triplicate */


The history of that line is way, way back a long time ago computer output
was
printed on impact lineprinters.  SAS overprinted error messages, effectively
putting them in bold face, so the user would be sure to see them.

Today, NO OVerPrinting usually makes more sense.

The example you gave ERROR^MERROR means that there is at least one ^M that
is not paired with a linefeed.  Hence Tim's supposition is probably correct.

Please reply to the list after you use the no overprint option and let us
know if that solved the ^M printing problem.

Rich

-----Original Message-----
From: ess-help-bounces at stat.math.ethz.ch
[mailto:ess-help-bounces at stat.math.ethz.ch] On Behalf Of Will
Sent: Wednesday, January 16, 2008 03:55 AM
To: ess-help at stat.math.ethz.ch
Subject: Re: [ESS] Replace control characters in log

Hi,

thanks for the comments so far. The third character of the mode line of 
the GNU .log file says "\" (DOS mode), but does not display ^M 
correctly. Additionally, I discovered that in BATCH mode the error 
messages are printed 3 times in the GNU Emacs SAS.log instead of 1 time 
like in the original SAS.log window.

Here's an example:

%%%%%%%%%%%%%%%Emacs - SAS.sas:%%%%%%%%%%%%%%%%%%%%%

PROC nonsense;
run;

%%%%%%%%%%%%%%%Emacs - SAS.log:%%%%%%%%%%%%%%%%%%%%%

1          PROC nonsense;
ERROR: Procedure NONSENSE not found.^MERROR: Procedure NONSENSE not 
found.^MERROR: Procedure NONSENSE not found.
2          run;

%%%%%%%%%%%%%%%SAS - SAS.log:%%%%%%%%%%%%%%%%%%%%%
1    PROC nonsense;
ERROR: Procedure NONSENSE not found.
2    run;

I open the SAS windows (.sas, .log, .lst, and *scratch*) with this function:

(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 left 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) '".sas"))
   (other-window 1)
   (find-file (concat (substring sas-file-name 0 -4) '"-temp.log"))
   (setq buffer-read-only  nil)
   (highlight-lines-matching-regexp "ERROR" 'hi-red-b)
   (setq buffer-read-only t)
   (other-window 1)
   (find-file (concat (substring sas-file-name 0 -4) '"-temp.lst"))
   (setq buffer-read-only t)
   (split-window-horizontally)
   (other-window 1)
   (switch-to-buffer '"*scratch*")
   (other-window 1)
)

Maybe the SAS batch command in my <.emacs> is also important:

(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)
;;;;;;;;;;;;;;;;;.emacs;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Maybe the SAS commands in my <autoexec.sas> are also relevant:

OPTIONS FORMCHAR='|----|+|---+=|-/\<>*'
         PAGESIZE=1000
         LINESIZE=75
         NOLABEL;

Thanks for your help,

Will

PS: If this settings don't work for you, please consider the following 
bug in the <ess-sas-submit-region> function, where the variable 
<ess-sas-submit-command-options> is missing. I patched the function 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)
      )
)


Will skrev:
> Dear ESS list,
> 
> it might sound strange but I am using GNU Emacs/ESS with SAS in a MS 
> Windows XP environment in Batch mode. I have the problem that in the log 
> window strange control characters appear ("^M") which mess up the layout.
> 
> How do I tell Emacs to replace those control characters with the correct 
> formatting?
> 
> Thanks in advance,
> 
> Will
> 
> ______________________________________________
> ESS-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help

______________________________________________
ESS-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help




More information about the ESS-help mailing list