Question

I have a submit /r; block in IML. 95% of the time, things run correctly. The other times there is an ERROR in R.

My log shows

ERROR: R: <whatever the error message is>

When an error occurs, the outputs are not available. Is there a way to trap or detect the first error so I do not attempt to pull outputs that don't exist?

Was it helpful?

Solution

Use the ok option in submit statement (ref). Later in the code, you can handle the error based on the value of the variable that stores the information from ok.

submit / R ok = isOK;
  * Do stuff;
endsubmit;

if isOK then do;
  * Handle the no error case;
end;
else
  * handle the error case;

It does not appear that you can capture the error message itself, unless you write the R script to return some error code instead of failing.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top