The following piece of code in the job's post code gets executed when the job's status is success.
Whereas, when the job fails, this code is not getting executed.
proc export data=lib_comm.TBL_COM_ERR_MASTER
outfile="&gen_log."
dbms=dlm replace;
delimiter='|';
run;
But we could execute a proc sql statement in the job's post code even when the job fails.
Is there are constraints that few statements cannot be executed in the post code when the job fails?
OK, that's a good start.
I just want to set the bigger picture first. When you use terms like "job" and "step" and "failure" those can vary in meaning depending on the operating system. What is the operating system? Is this all one long SAS job, so that "step" refers to a DATA or PROC step within the same job? Does "failure" mean there was a SAS error message, or does it mean something else?
The solution may be as simple as adding something like this just before the PROC EXPORT:
options nosyntaxcheck;
You should certainly consider reversing that right after the PROC EXPORT:
options syntaxcheck;
So here's a possible solution, as well as more questions.
You haven't given much information about what "failure" means. Did the failed job actually create lib_comm.TBL_COM_ERR_MASTER? Did it actually create the macro variable &GEN_LOG? Did the failure occur in the step just before the PROC EXPORT?
a. This job is not creating lib_comm.TBL_COM_ERR_MASTER. It is already created.
b. &GEN_LOG is a macro global variable and it is also resolved in the job.
c. Failure occurs before the job.
The error is like "this step is stopped" because error occuered before this export.
OK, that's a good start.
I just want to set the bigger picture first. When you use terms like "job" and "step" and "failure" those can vary in meaning depending on the operating system. What is the operating system? Is this all one long SAS job, so that "step" refers to a DATA or PROC step within the same job? Does "failure" mean there was a SAS error message, or does it mean something else?
The solution may be as simple as adding something like this just before the PROC EXPORT:
options nosyntaxcheck;
You should certainly consider reversing that right after the PROC EXPORT:
options syntaxcheck;
So here's a possible solution, as well as more questions.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.