Desktop productivity for business analysts and programmers

Stop process without disconnecting from Server

Reply
Respected Advisor
Posts: 3,823

Stop process without disconnecting from Server

Hi all

I’m working on a macro which should stop a SAS process under certain conditions.

Everything works fine for batch jobs – but what command would I have to submit if this code runs out of an EG session and I just want to stop the process without disconnecting from the server (behavior like ‘stop’ in the EG 4.2 ‘Task Status Window’?

Feels like an old problem – but I just can’t recall how it’s done.


I tried…

data _null_;
put 'Before Abort';
abort return 0 nolist;
put 'After Abort';
run;

…but this ends the session and I lose all the work tables.


Thanks in advance
Patrick
Respected Advisor
Posts: 3,823

Re: Stop process without disconnecting from Server

No one?!

Does this now mean "dumb question" or "can't be done"?
Community Manager
Posts: 2,691

Re: Stop process without disconnecting from Server

In batch mode (not within EG) you might consider the new checkpoint/restart options:

http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a000993436.htm

Otherwise, your option code is to wrap your SAS logic in macro functions, and conditionally run those functions based on the state of things.

Chris
Respected Advisor
Posts: 3,823

Re: Stop process without disconnecting from Server

Hi Chris

What I actually wanted to do is to test SAS scripts developed in EG which are using a macro at the beginning of the script which stops processing under certain conditions (ETL process: Don't load data already loaded into a target table but stop processing).

Seems I can develop the code with EG but have to test it in batch in order to not get disconnected from the workspace server.

Thanks
Patrick
Community Manager
Posts: 2,691

Re: Stop process without disconnecting from Server

See the section "ENDING CONTROL WITH THE ENDSAS STATEMENT" near the end of this paper:

http://support.sas.com/resources/papers/sgf2008/eguide.pdf

You still might consider using macro logic to conditionally execute the pieces you might need, rather than use ABORT. ABORT works fine in batch, but if you ever want to run the process in a stored process or in EG, ABORT or ENDSAS might have undesired consequences.

Chris
Ask a Question
Discussion stats
  • 4 replies
  • 558 views
  • 0 likes
  • 2 in conversation