BookmarkSubscribeRSS Feed
Patrick
Opal | Level 21
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
4 REPLIES 4
Patrick
Opal | Level 21
No one?!

Does this now mean "dumb question" or "can't be done"?
ChrisHemedinger
Community Manager
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
SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
Patrick
Opal | Level 21
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
ChrisHemedinger
Community Manager
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
SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 2950 views
  • 0 likes
  • 2 in conversation