how to stop SAS jobs

  • Follow


Hi,
I am running a certain code and would like to ask SAS stop all later
jobs if certain conditional doesn't meet.
Does the STOP or ABORT only stop the current step? Do I have to
include everything into one macro to make it happen? Or can I ask SAS
to stop whenever the condition is not met.

Thanks!!!
0
Reply zengwei917 (19) 8/26/2010 7:13:53 PM

On Aug 26, 3:13=A0pm, MICKEY_sas_beginner <zengwei...@gmail.com> wrote:
> Hi,
> I am running a certain code and would like to ask SAS stop all later
> jobs if certain conditional doesn't meet.
> Does the STOP or ABORT only stop the current step? Do I have to
> include everything into one macro to make it happen? Or can I ask SAS
> to stop whenever the condition is not met.
>
> Thanks!!!

If you want to stop the whole SAS program then you can use the ABORT
statement.  But if you are running you code interactively from the SAS
display manager then watch out because it closes SAS complete, not
just stopping the few lines of programming that you might have
submitted.

SAS does not support setting a trap on error that some other languages
do. Perhaps if you are writing in SCL you can do this.

What I have used is a generic macro that takes as its main parameter a
condition.If the condition is false then it does nothing.
If the condition is true the it will issue an error message to the
log.
If you are running non-interactively and have set the system option
ERRORABEND then it will abend SAS.
If you are running interactively then it will pop-up a window with the
error message and wait for user input.
At this point you could halt the submitted code (Ctrl-Break on PC/SAS
or push the interrupt button on the session control window when
running on Unix).
Or you could just hit enter and let the program continue.
Here is the macro header:


 1 %macro bailout
  2 /
*----------------------------------------------------------------------
  3 Stop processing a batch job when specified condition is true AND
option
  4 ERRORABEND is turned on. Pop up window in interactive environment.
  5
----------------------------------------------------------------------
*/
  6 (cond         /* SAS statement which evaluates to 0 or 1 */
  7 ,code=3D13      /* Abend code */
  8 ,msg1=3D        /* Message 1 */
  9 ,msg2=3D        /* Message 2 */
 10 ,msg3=3D        /* Message 3 */
 11 ,msg4=3D        /* Message 4 */
 12 ,msg5=3D        /* Message 5 */
 13 ,env=3D&sysmenv /* used to fix version 8 bug */
 14 );
0
Reply Tom 8/28/2010 12:04:05 AM


1 Replies
976 Views

(page loaded in 0.479 seconds)

Similiar Articles:













7/22/2012 8:53:38 AM


Reply: