07-10-2017 02:27 PM
I'm trying to find a way to halt execution at a particular row. "Abort Abend" will do it, but it also seems to delete all my temprorary files. Is there a way to stop execution at particular row and keep the temporary files in the work directory?
07-10-2017 02:45 PM
In a DATA step, the STOP statement halts the current step. For example:
if amount > 5000 then stop;
It stops before outputting the current observation. In this case, the output data set contains zero observations with amount greater than 5000.
07-10-2017 02:48 PM
Understood. However, unless I'm mistaken, the stop statement within a data step would only halt execution for that particular data step. Subsequent steps would proceed. I'd like the halt execution of the entire program, so no subsequent steps would run.
07-10-2017 02:54 PM
That takes a lot more work. For example, you could define a macro:
Then end every step by replacing the RUN; statement with:
Then in your DATA step:
if amount > 5000 then call symput('halt', 'cancel');
Before this point, the %RUNN macro would generate:
Afterwards, it generates:
There's no easy way that I know of.