|
Hi Kevin,
The macro wrapper is always an availability.
I tossed in the RUN CANCEL option for those
times when you do not know how many and which
remaining datasteps are to be cancelled. If
you had 30 datasteps, and more than one or
even many datasteps have the ability to set
the cancel flag, you would now have a very
convoluted matrix of which datasteps are to
be not run. The RUN CANCEL in a multi-location
flagging layout would avoid a very messy and
very busy looking multiple-multiple-layered
set of macro %IF statement wrappers around
you datasteps which we hope remain easy to read.
You could end up with a large number of wrappers
and the nesting could possibly get pretty ugly.
The macro wrapper we use almost every day in
one location or another for more static flow
issues. The original question here lended
at least a mention of an alternative that may
or may not fit (and also up to the users asthetic
desires).
Thanks for reminding the users of this thread
that the macro wrapper is available too!
...just didn't want to throw the baby out with
the bath water, as the old saying goes, since
both avenues are useful tools to pick from
depending upon desires, need, look, etc. ...
Hope this is helpful.
Mark Terjeson
Senior Programmer Analyst, IM&R
Russell Investments
Russell Investments
Global Leaders in Multi-Manager Investing
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Kevin Roland Viel
Sent: Wednesday, September 19, 2007 2:23 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Programatically signal the executor to 'Break'
On Wed, 19 Sep 2007, Terjeson, Mark wrote:
> Ah, yes.
>
> Well, this ain't exactly pretty but
> have used this in the past for datasteps.
> You'll have to take other measures for
> procs and other open code. Also you would
> have to take measures for the dataset
> created by the STOPped datastep. i.e.
> remove it or not, etc.
>
>
> data one;
> run;
>
> data two;
> condition=1;
> if condition then
> do;
> call symput('MYSTATE',' cancel ');
> stop;
> end;
> run;
>
> data three;
> run &mystate;
>
> data four;
> run &mystate;
What? Yes, RUN CANCEL is a good construct, but why not just use a macro
wrapper, if you are using a macro variable at all and an appropriate
(global) command like ENDSAS is not available.
%macro continue_it ;
%if &MYSTATE. ne CANCEL %then
%do ;
data three ;
run ;
data four ;
run ;
%end ;
%mend continue_it ;
%continute_it
Of course, I would prefer a parameter list, but Richard is quite
competent
to improve the design.
HTH,
Kevin
Kevin Viel, PhD
Post-doctoral fellow
Department of Genetics
Southwest Foundation for Biomedical Research
San Antonio, TX 78227
|