BookmarkSubscribeRSS Feed
weg
Obsidian | Level 7 weg
Obsidian | Level 7

My goal is to use saspy on a linux server with sas 9.4 installed.  When I initializes a session with sas = saspy.SASsession(), python freezes and sas takes over like I'm being prompted for input (which should't happen per the examples), but there is no text displayed, and the interactive mode will not end after an "end;" statement. If I hit ctrl+c/ctrl+d sas gives the exit y/n termination prompt and then the python program crashes.

 

When I try the command it is attempting to use, I get the same results with no text output.  typing in text does not execute anything after the end statement is reached

/apps/SAS/v9.4/SASHome/SASFoundation/9.4/bin/sas_en -fullstimer -nodms -stdio -terminal -nosyntaxcheck -pagesize MAX

(same results with sas_u8)

 

same if I just call sas -stdio -terminal. I cant call just sas with no arguments since the server doesnt have an x11 server configured and I get an error.

 

the only other thing I notice is after running a session a  __STDERROR__ file appearing in my home directory that appears to be the log file.  any text I enter seems to run but sas doesnt seem to be able to attach to the terminal directly.

 

I'm guessing this belongs in deployment since it seems to be an issue with the sas config, but I can put it in a different spot if someone things that would be better.

 

 

 

 

16 REPLIES 16
gwootton
SAS Super FREQ
Running the sas binary with the -nodms option should send the prompts to the terminal, does that not happen for you?
--
Greg Wootton | Principal Systems Technical Support Engineer
weg
Obsidian | Level 7 weg
Obsidian | Level 7

hmm yes it does.  so I'm guessing the lack of text when calling sas -nodms -stdio -terminal is expected behavior?

gwootton
SAS Super FREQ
When I run SAS with the stdio option it does not return a prompt (e.g. 1?) but I still see output from the starting of SAS (copyright info, version, etc) in my terminal. If you do not see those that makes me think stdout is being redirected elsewhere. The stdio option lets you use redirects to pass commands to SAS or output from SAS. I believe that's how saspy works when using the stdio connection option. After you run sas with the -stdio option if you submit "endsas;" does it return to the prompt?

STDIO System Option: UNIX
https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/hostunx/n00se9h5vrwqrbn1uu4nb0yysmdl.htm
--
Greg Wootton | Principal Systems Technical Support Engineer
weg
Obsidian | Level 7 weg
Obsidian | Level 7
No I dont see any text using sas -stdio besides the termination prompt once I hit ctrl+c. I get __STDERROR__ in the directory I am in with the logs but nothing else
gwootton
SAS Super FREQ
So submitting endsas; doesn't terminate it either? It sounds like your stdio is not being directed to your terminal session then. Not sure why that would be, but that may be why saspy isn't working either.
--
Greg Wootton | Principal Systems Technical Support Engineer
weg
Obsidian | Level 7 weg
Obsidian | Level 7

"endsas;" will terminate as if I hit ctrl+d but there is no output. 

 

running sas filename.sas works fine and any linux commands work correctly with redirecting &1 and &2 for stdout/stderr

gwootton
SAS Super FREQ
If you redirect the output of sas to another file is it captured? e.g. sas -nodms -stdio > test.log 2>&1

then submit endsas; to terminate?
what if you redirect to /dev/stdout?
--
Greg Wootton | Principal Systems Technical Support Engineer
weg
Obsidian | Level 7 weg
Obsidian | Level 7

sas -nodms -stdio > test.log 2>&1 results in blank test.log and the __STDERR__ file that keeps getting created has the log output

 

same with redirecting to /dev/stdout without updating the test.log file

 

the return code $? is 0 for both cases

Tom
Super User Tom
Super User

I don't understand what you are trying to do and how Python has anything to do with it.

 

If you want run SAS interactively from a dumb terminal just use:

sas -nodms

When you use -stdio you usually have some file with the commands that you want to push into SAS then just send to standard input.  I think the stdout is the LISTING and stderr is the LOG.

cat myfile.sas | sas -stdio

 

gwootton
SAS Super FREQ
@Tom I believe they are trying to use the STDIO access method for saspy which is hanging when running sas = saspy.SASsession() and so are troubleshooting by running the command directly.
--
Greg Wootton | Principal Systems Technical Support Engineer
weg
Obsidian | Level 7 weg
Obsidian | Level 7

@gwootton  @Tom  yes I mentioned python to make these points to help get an answer:

 

1) I am not interested in running an interactive session in and of itself so alternative access methods wont help with a solution, I only care about getting it to work so I can read and write sas files in python using this package.

2) the issue is not with the python package it is with sas is not interfacing with the stdio correctly, since I get the same results running the sas code directly.

3) the issue is not with linux since all other programs are working as expect and output can redirect as expected

 

thanks,

Tom
Super User Tom
Super User

Try a simple self contained command.

echo 'proc print data=sashelp.class(obs=3);run;' | sas -stdio -noautoexec 2>&1

Works for me

1                                                          The SAS System                           17:17 Tuesday, November 14, 2023

NOTE: Copyright (c) 2016 by SAS Institute Inc., Cary, NC, USA. 
NOTE: SAS (r) Proprietary Software 9.4 (TS1M7) 
      Licensed to xxx
NOTE: This session is executing on the Linux 3.10.0-1160.15.2.el7.x86_64 (LIN X64) platform.



NOTE: Analytical products:
      
      SAS/STAT 15.2
      SAS/ETS 15.2
      SAS/OR 15.2
      SAS/IML 15.2
      SAS/QC 15.2

NOTE: Additional host information:

 Linux LIN X64 3.10.0-1160.15.2.el7.x86_64 #1 SMP Thu Jan 21 16:15:07 EST 2021 x86_64 Red Hat Enterprise Linux Server release 7.9 
      (Maipo) 

NOTE: SAS initialization used:
      real time           0.05 seconds
      cpu time            0.03 seconds
      
1    proc print data=sashelp.class(obs=3);run;                                                           The SAS System                       17:17 Tuesday, November 14, 2023   1

                                          Obs     Name      Sex    Age    Height    Weight

                                            1    Alfred      M      14     69.0      112.5
                                            2    Alice       F      13     56.5       84.0
                                            3    Barbara     F      13     65.3       98.0
NOTE: There were 3 observations read from the data set SASHELP.CLASS.
NOTE: The PROCEDURE PRINT printed page 1.
NOTE: PROCEDURE PRINT used (Total process time):
      real time           0.02 seconds
      cpu time            0.02 seconds
      
NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414
NOTE: The SAS System used:
      real time           0.08 seconds
      cpu time            0.05 seconds
      
weg
Obsidian | Level 7 weg
Obsidian | Level 7

@Tom hmm that got me somewhere:

$ echo 'proc print data=sashelp.class(obs=3);run;' | sas -stdio -noautoexec 2>&1
The SAS System 17:32 Tuesday, November 14, 2023 1

Obs Name Sex Age Height Weight

1 Alfred M 14 69.0 112.5
2 Alice F 13 56.5 84.0
3 Barbara F 13 65.3 98.0

$

 

I'm still got getting log output but proc print seems to work

 

Tom
Super User Tom
Super User

When you use:

sas -nodms

Does it show you the LOG output?

 

If not them something is messed up with your SAS command.

 

Also are you running SAS on a single machine?  Or are you using some type of GRID to actually run SAS on some other machine?  What GRID are you using? LSF?  Perhaps those settings are wrong?

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

Get Started with SAS Information Catalog in SAS Viya

SAS technical trainer Erin Winters shows you how to explore assets, create new data discovery agents, schedule data discovery agents, and much more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 16 replies
  • 2985 views
  • 0 likes
  • 3 in conversation