How to delete .filepart files in SAS Enterprise Guide - sas

There's incomplete .filepart files in a Tests folder in SAS Enterprise Guide and I would like to delete all of them.
When I try to right click and delete, it gives me an error saying "Insufficient authorization to access /.../Tests/file.filepart"
I also tried doing this and it didn't do anything.
%macro check(file);
%if %sysfunc(fileexist(&file)) ge 1 %then %do;
%let rc=%sysfunc(filename(temp,&file));
%let rc=%sysfunc(fdelete(&temp));
%end;
%else %put The file &file does not exist;
%mend check;
%check(/.../Tests/file.filepart)

Insufficient authorization means that the user running the SAS script does not have write permission to the file you are deleting.
Did a different process / user create the .filepart files? If you have authorization to change permissions then you can use the chmod command prior to deletion to give yourself write permission (using system() or call system or x within SAS itself. If not, then this is really a system issue and you need have your admins take care of the issue for you.

Related

Libname Connection to SAS Access to Redshift throwing CLI error

We recently got SAS Access to Redshift license and are trying to connect to Redshift database directly without ODBC.
This is the libname statement I am using
libname A1 redshift server='XXX' port=5439 user='YYYY' password='ZZZZ' Database='RRRR';
It is however throwing the following error
ERROR: CLI error trying to establish connection: [unixODBC][Driver
Manager]Can't open lib 'SAS ACCESS to Amazon Redshift' : file not
found ERROR: Error in the LIBNAME statement.
Are there any configurations we need to do before using SAS Access to Redshift?
Thanks in advance.
Yes - you need to configure your ODBC settings.
You can find a very detailed guide here and additional guidance here

assigning a metadata user via the sassrv account

I have built a test harness on the STP server, that spawns unique sessions for each test run. The problem I have now is that one of my tests requires the use of a metadata account (and my spawned sessions are running under the sassrv system account).
For info, the code snippet that spawns those sessions is below:
/**
* Execute all the backtest scripts and retain the logs
*/
options sascmd='!sascmd';
%local waitforlist;
%do x=1 %to %get_attrn(backtest_scripts,NLOBS);
signon connx&x;
%syslput LOC_BACKTEST_SCRIPTS=&LOC_BACKTEST_SCRIPTS /remote=connx&x;
%syslput TEST_RUN_NO=&TEST_RUN_NO /remote=connx&x;
%syslput TEST_ID=Test&x /remote=connx&x;
%syslput TEST_PGM=&&test&x /remote=connx&x;
%syslput LOC_TEST_RESULTS=&LOC_BACKTEST_LOGS\Test_&TEST_RUN_NO
/remote=connx&x;
%syslput LOG_LOC=&LOC_BACKTEST_LOGS\Test_&TEST_RUN_NO\&&test&x...log
/remote=connx&x;
rsubmit connx&x wait=no ;
proc printto log="&LOG_LOC"; run;
options mprint source source2;
%inc "&LOC_BACKTEST_SCRIPTS\&test_pgm..sas";
endrsubmit;
%let waitforlist=&waitforlist connx&x;
%end;
waitfor _all_ &waitforlist;
%do x=1 %to %to %get_attrn(backtest_scripts,NLOBS);
signoff connx&x;
%end;
My question - how do I now connect as a metadata user via the sassrv account? I know I could use the -metauser XXX -metapass XXX options but I'd rather not embed passwords in my script if possible..
I know (now) that we cannot set up the sassrv account as a metadata user, as it is already in use (SAS General Servers group). I also need streaming output, so cannot use the workspace server. I tried using AUTHDOMAIN on my rsubmit statement but keep getting:
ERROR: Retrieving login information based on AuthenticationDomain from
the SAS Metadata Server failed.
So, in the end, I had to connect via an options statement with metauser / metapass (encoded) credentials. However, to avoid surfacing these in the code (or in the log) we created a network share that only the system accounts could access.. Then simply %inc'd a text file containing the credentials (with option nosource2 to be sure).
Job done!

How to signon and rsubmit with user and password option, and suppress autoexec.sas in SAS

Is there a way to Not run autoexec.sas, during remote signon and rsubmit?
I have tried sascmd="sas -noautoexec" but it conflicts with the user= and password= options.
You can do as suggested by he wei
%let server = unix.penn.edu 4016; options comamid=TCP signon server nocscript sascmd='sas -noautoexec' user=aaa password=bbb; Rsubmit;
Or use another include in the program you want to recreate the macro variable user and password.

SAS options not persistent on SAS Server

I am using this
signoff;
*** REMOVED CONNECTION BLOCK;
signon;
rsubmit;
%put REUSE= %sysfunc(
getoption(REUSE)); *says no;
%put COMPRESS= %sysfunc(
getoption(REUSE)); *says no;
options compress=YES;
options reuse=YES;
endrsubmit;
And even after the option is set, whenever I reconnect it will say NO/NO for these two options.
How do I make them persistent?
Thanks
the session is ending with endrsubmit;
To persist the session:
rsubmit persist=yes;
One option for having settings persist across sessions is to use a custom autoexec file. Assuming you have access to edit your .ini file that contains the connection script, you can add -autoexec myfile.sas to that script, which would cause myfile.sas to be executed upon server connection.

SAS 9.3 email attachment

Since upgrading to SAS 9.3, i'm only able to send emails within rsubmit, which isnt a problem... however i'm unable to attach local files, please can someone assit?
RSUBMIT;
FILENAME outmail EMAIL
SUBJECT="Daily report attached"
TO= ("xxxxx#xx.com")
ATTACH= "C:\Users\one\Desktop\Cars.xls";
DATA _NULL_;
FILE outmail;
PUT "Hello All,";
PUT ;
PUT "Please find attached the Cars report.";
PUT ;
PUT "Regards";
PUT ;
RUN;
I receive the following error message in the log:
ERROR: Error opening attachment file C:\Users\one\Desktop\Cars.xls.
ERROR: Physical file does not exist, /home/one/C:\Users\one\Desktop\Cars.xls.
Any help is much apriciated.
Thank you
Your RSUBMIT is being submitted on a server, so inside the RSUBMIT the paths are local to the server. Unless it can see your desktop (ie, via a mapped drive) it won't be able to access files on the local machine. You would have to upload them to the server first.