[ESS] trouble with interactive SAS mode in ESS 13.09-1

Boylan, Ross Ross.Boylan at ucsf.edu
Thu Nov 10 22:18:28 CET 2016

I don't seem able to get my code to execute in SAS.  Specifically, only the first line in the region seems to be transmitted.  Could the fact it is in a file that does not have a .sas extension be a factor?  Also, I have problems exiting.  BTW, http://ess.r-project.org/Manual/news.html doesn't show any SAS-related changes after 13-09-1.

Here's what happens:
start emacs 24.3.1 on linux/Ubuntu
open file  tng-sim0000_1.mprint in emacs.
M-x sas-mode
buffer mode line now shows ESS[SAS] [SAS]
emacs now shows 4 panels, including *SAS.log* showing initialization of the SAS system (in other words, it found the executable).
I switch to the mprint buffer and highlight the region I want to execute and hit C-c C-r.
Emacs displays "starting evaluation ..." at the bottom, and just stays that way.  It is unresponsive to most keypresses, except to beep.  There are no visible changes in other buffers.
C-g interrupts things.  The log window now shows the first line only of the buffer.  If I've done this before it causes the prior single line to execute.

The behavior I'm expecting when I hit C-c C-r is for the entire region to execute (since it has run; at the end) and appropriate log and list output to  appear.

Another oddity is that the log and list windows both look as if they have shells in them, though I presume that is by design.  That may be related to my exit problem:

In the mprint buffer I go
C-c C-q and confirm I want to exit.
endsas; appears in the log and *SAS* buffers; the latter also shows "Process SAS finished at ..."
However, when I switch to the log or lst buffer and try to kill it (C-x C-k) I get the message that it has a running process and asking if I want to kill it.  This puzzled me since the SAS process is supposed to be dead.  Maybe a reference to the apparent shell process of the buffer?

sh-4.3$ tty

---------------------------*SAS* after 3 attempts------------------------------------------------
+ stdout=/dev/pts/4
+ stderr=/dev/pts/5
+ shift 2
+ set +x
sas </dev/tty 1>/dev/pts/4 2>/dev/pts/5 -stdio -linesize 80 -noovp -nosyntaxcheck
data gen ids;                                                                                                                                         
data gen ids;                                                                                                                                         
data gen ids;             

---------------------------*SAS.log* (with some lines removed)-----------------------------------------------------
sh-4.3$ tty
sh-4.3$ 1                                The SAS System
                                               12:29 Thursday, November 10, 2016

NOTE: Copyright (c) 2002-2012 by SAS Institute Inc., Cary, NC, USA. 
NOTE: SAS (r) Proprietary Software 9.4 (TS1M3) 
NOTE: This session is executing on the Linux 4.4.0-47-generic (LIN X64) 

NOTE: Additional host information:

 Linux LIN X64 4.4.0-47-generic #68~14.04.1-Ubuntu SMP Wed Oct 26 19:42:11 UTC
      2016 x86_64 Unrecognized Linux Distribution

NOTE: SAS initialization used:
      real time           1.28 seconds
      cpu time            0.05 seconds

2    data gen ids;
NOTE: The data set WORK.GEN has 1 observations and 0 variables.
NOTE: The data set WORK.IDS has 1 observations and 0 variables.
NOTE: DATA statement used (Total process time):
      real time           34.58 seconds
      cpu time            0.02 seconds

3    data gen ids;
NOTE: The data set WORK.GEN has 1 observations and 0 variables.
NOTE: The data set WORK.IDS has 1 observations and 0 variables.
NOTE: DATA statement used (Total process time):
      real time           14:47.20
      cpu time            0.03 seconds
^L2                                The SAS System
                                               12:29 Thursday, November 10, 2016

4    data gen ids;

-------------------------- region I'm trying to execute------------------------------
data gen ids;                                                                                                                                         
call streaminit(123);                                                                                                                                 
srho = sqrt(abs(0.5));                                                                                                                                
smrho = sqrt(1-abs(0.5));                                                                                                                             
drop srho smrho;                                                                                                                                      
do iSim = 1 to 1;                                                                                                                                     
do id = 1 to 40000;                                                                                                                                   
if id <= 12000 then g=1;                                                                                                                              
else g=-1;                                                                                                                                            
a0 = rand('NORMAL');                                                                                                                                  
a1 = rand('NORMAL');                                                                                                                                  
a2 = rand('NORMAL');                                                                                                                                  
a0 = ((exp(a0*0.01)-1)/0.01 * exp(0.2*a0**2/2) - 0.006987930800249634)/1.4670501788740913;                                                            
a1 = ((exp(a1*0.01)-1)/0.01 * exp(0.2*a1**2/2) - 0.006987930800249634)/1.4670501788740913;                                                            
a2 = ((exp(a2*0.01)-1)/0.01 * exp(0.2*a2**2/2) - 0.006987930800249634)/1.4670501788740913;                                                            
b0 = (smrho*a0 + srho*a2)*1;                                                                                                                          
bT = (smrho*a1 + srho*a2)*1;                                                                                                                          
output ids;                                                                                                                                           
regularN = 0;                                                                                                                                         
regularStep = 0;                                                                                                                                      
drop regularN regularStep;                                                                                                                            
do step = -0 to 100-0;                                                                                                                                
T = -0.5 + 1 * step/100;                                                                                                                              
regular = (step >= regularStep);                                                                                                                      
if regular then do;                                                                                                                                   
regularN + 1;                                                                                                                                         
regularStep = round(regularN * 100 * 0.5);                                                                                                            
gammav = 0;                                                                                                                                           
else do;                                                                                                                                              
gammav = 0;                                                                                                                                           
eta = 0 + b0 + (1 + bT)*T + 2 * g + 3 * g * T;                                                                                                        
Y = rand('NORMAL', eta, 1);                                                                                                                           
YForVisit = eta;                                                                                                                                      
output gen;                                                                                                                                           

More information about the ESS-help mailing list