BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Sandhyaa
Calcite | Level 5

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?

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

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.

View solution in original post

3 REPLIES 3
Astounding
PROC Star

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? 

Sandhyaa
Calcite | Level 5

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.

Astounding
PROC Star

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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to connect to databases in SAS Viya

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.

Discussion stats
  • 3 replies
  • 1008 views
  • 0 likes
  • 2 in conversation