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
It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
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
It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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