I am using SAS, an analytics software package for Unix (amongst others). I am connecting to my Unix system with PuTTY.

I want to submit 10 sas programs via putty. My requirement is that each job should run in a sequence (ex: 2nd job should run after 1st job, 3rd job should run after completion of 2nd job) and also if there is any error in job complete running process should stop (ex: if there was an error in second job then 3rd job should not run.)

Currently I am submitting jobs as shown below, but the problem is that all of the jobs are started at the same time; I need one at a time as explained above.

x sasb -sv sas92 code1.sas;
x sasb -sv sas92 code2.sas;
x sasb -sv sas92 code3.sas;

The x command here is how to run a Unix command from within SAS. sasb is the name of the command that I am running that way, which seems to be running all jobs simultaneously.


Execution in a bash (which I'm just guessing that you're using on the remote server) is separated by ; to start the commands after each other. My guess is that your code starts a background process.

Try it with && which will allow the next execution only if the predecessor ran successfully.

x sasb -sv sas92 code1.sas &&
x sasb -sv sas92 code2.sas &&
x sasb -sv sas92 code3.sas
  • The x gives away that the questioner is not using the Bourne Again shell. Here is another clue. Have a guess what the b could possibly mean. You could make this answer so much better. (-: – JdeBP Feb 28 '18 at 21:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.