Reputation: 81
I was wondering if it's possible to execute a bat file i created via SAS?
Reason for this is, unfortunately I do not have admin privileges to schedule the execution of my batch file on task scheduler when I'm not logged in...I need to be logged in for the batch file to execute.
On the contrary my team schedules jobs on SAS so I was wondering if there is a command that can execute my .bat file through the same concept?
I'm happy to accept any other solutions
Thanks.
Upvotes: 1
Views: 3528
Reputation: 12691
I always suggest using a pipe fileref when calling OS commands, this way you can capture both STDOUT and STDERR.
data _null_;
infile "C: & C:\path\to\your.bat 2>&1" pipe;
input;
putlog _infile_;
run;
To explain the command:
1) First, change the drive (not necessary if SAS is on the same drive as the .bat file). This is the C:
part.
2) Next, execute the file (C:\path\to\your.bat
)
3) Finally, redirect STDERR to STDOUT (the 2>&1
part). This will show you any errors.
If you still get nothing, try executing the batch file manually using the same account as you use in SAS, and - on the same machine (eg where the SASApp server is hosted). In a batch environment this may be a batch user. In a Stored Process context it may be sassrv
(or equivalent).
Upvotes: 2