03-13-2017 09:37 AM - edited 03-13-2017 09:38 AM
I have a job that will check if a certain date exists in a data set.
If it does I want the next few nodes of the job to execute, if not I want the job to stop completely.
How can this be done?
03-13-2017 10:04 AM
Ca you use SAS code? If so:
%if %sysfunc(fileexists(...)) %then %do;
Or sort data nodupkey to create a dataset, then check sashelp.vtable:
set sashelp.vtable (where=(libname="<libname>" and memname="<dataset>" and nobs > 0));
call execute('%include <next job>';
Will only call the execute if more than 0 obs.
03-13-2017 10:29 AM
@RW9 example would certainly work programming wise, but it's not really DI Studio best practice...
You could use the same logic with an Extract, and have that as output to a Loop. No entries in the look up table, no loops.
Another option is to use post cade in the extract, if the result table is empty, execute endsas/abort abend etc.
Third option is try to use the Conditional Start/End transformations.
03-13-2017 10:42 AM
Just for reference, Aidan has asked related questions in
Personally, I would dissect the job into its parts and have the scheduler handle the continuation conditions, controlled by return codes from the single jobs, or by the execution date as such.
03-13-2017 11:06 AM
03-13-2017 11:09 AM
@KurtBremser I needed some more direction so had to post a new thread as it could be that I am approaching this incorrectly. Very new to writing on the fly SAS code so need more direction on this,
No problem. I just wanted to give everybody new to the topic a chance to see what was already talked about. Otherwise I'd have merged the threads into one, but I see an evolution of the theme(s)
03-14-2017 07:02 AM
I have pre code in an extract node to check if data set is blank;
dsid = open("&_Input");
I will only then e-mail the results if the data set is not blank as per below;
PROC EXPORT DATA=work.W4JQ299
%if &NOBS <> 0 %then %do;
file sendit email
put "Hi all,";
put "Kind Regards,";
The email code doenst seem to be working, any ideas?
I have removed the e-mail address and file location for security on here
03-14-2017 11:04 AM