Back to Tech Corner
SAS Admin

(Apr 2023) Permission Issues for Scheduled Jobs and How to Troubleshoot

It is quite usual that we experience file permission issue where the SAS code we develop and run executes without an error, however once scheduled; SAS Scheduler or Windows Task Scheduler, the job fails due to permissions issue. The solution is to find the effective permission of the scheduled job and grant access accordingly.

We also ran into a similar issue. Following is the technique we used to resolve the issue. We hope that you may find it useful as well.

For the test we used the following program:

libname test "\full\path\of\target\data";

data _null_;
  user=sysget('USERNAME');
  domain=sysget('USERDOMAIN');
  put user;
  put domain;
run;

data test.x;
  x=1;
run;

What this code does is firstly write out to the log the username and domain of the user that is running the code. Then it creates a samples dataset. What we found was when we ran the code from a SAS session similar to EG it ran under the developer's ID.

Then we scheduled the code to run via the scheduler and as expected it failed, but what we found was that when run under the scheduler it ran under the SYSTEM account in the <XYZ> domain.

Therefore, we need to make sure that the system account has read, write, modify, delete, create permissions on all files created by users in that target library.