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.
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:
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
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
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
@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
When you use:
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?
The SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment.
Learn how to install the SAS Viya CLI and a few commands you may find useful in this video by SAS’ Darrell Barton.
Find more tutorials on the SAS Users YouTube channel.