Hello,
I have a STP which runs under the sassrv technical user. With the follwing x-command I create a list of all work-directories with a certain table inside of them and then want to import it as a table. When I run the code as another user it works fine, but with the sassrv user nothing gets imported.
Coding:
x "find &workpath. -name &tableName..sas7bdat > &workpath./work_directories.txt";
proc Import datafile="&workpath./work_directories.txt"
out=work.work_finding_1
dbms=dlm
replace;
getnames=NO;
run;
Result when I run the coding with my user:
NOTE: The infile '/work_p/work_directories.txt' is:
Filename=/work_p/work_directories.txt,
Owner Name=XXXXXXX,Group Name=XXXXXX,
Access Permission=-rw-r--r--,
Last Modified=16Sep2019:10:38:22,
File Size (bytes)=81
NOTE: 1 record was read from the infile '/work_p/work_directories.txt'.
The minimum record length was 80.
The maximum record length was 80.
NOTE: The data set WORK.work_finding_1 has 1 observations and 1 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
Result when sassrv runs the same code:
NOTE: The infile '/work_p/work_directories.txt' is:
Filename=/work_p/work_directories.txt,
Owner Name=sassrv,Group Name=sas,
Access Permission=-rw-r--r--,
Last Modified=16. September 2019 10.38 Uhr,
File Size (bytes)=81
NOTE: 0 records were read from the infile '/work_p/work_directories.txt'.
NOTE: The data set WORK.WORK_finding_1 has 0 observations and 1 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds
Content of the txt File:
/work_p/SAS_work1D9C015D00B6_macdb001/SAS_work0994015D00B6_macdb001/aa1.sas7bdat
I am completly lost as to why this is happening.
Any help would be greatly welcomed
Kind Regards
Criptic
Looks strange to me, as the permissions for the file is the same in both cases, and the file size as well.
Could it be that the system option OBS has been set to 0 somewhere earlier in the program, when it runs on the server? SAS sets the system option SYNTAXCHECK in batch mode, meaning that if an error is encountered, it sets OBS to 0 and continues. You may want to look for errors earlier in the log from the batch session. An alternative is to set the ERRORABEND option in the batch program, so that it stops when an error is encountered, or (the dirty way) to set the option NOSYNTAXCHECK, so that SAS continues with OBS=MAX (or whatever you have explicitly set it to earlier).
Looks strange to me, as the permissions for the file is the same in both cases, and the file size as well.
Could it be that the system option OBS has been set to 0 somewhere earlier in the program, when it runs on the server? SAS sets the system option SYNTAXCHECK in batch mode, meaning that if an error is encountered, it sets OBS to 0 and continues. You may want to look for errors earlier in the log from the batch session. An alternative is to set the ERRORABEND option in the batch program, so that it stops when an error is encountered, or (the dirty way) to set the option NOSYNTAXCHECK, so that SAS continues with OBS=MAX (or whatever you have explicitly set it to earlier).
@s_lassen thank you every much this seems to be the problem for me, as I tested it with
data work.test;
set sashelp.class;
run;
* Log-Entry;
NOTE: There were 0 observations read from the data set SASHELP.CLASS.
NOTE: The data set WORK.TEST has 0 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.00 seconds
The Log I can view of the STP in EG doesn't contain any warnings or errors so the error must occur somewhere in the autoexec-flow of the STP. Is there a way to view that log?
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.