Date: Tue, 30 Aug 2011 03:31:19 -0400
Reply-To: Peter Crawford <Peter.Crawford@BLUEYONDER.CO.UK>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Peter Crawford <Peter.Crawford@BLUEYONDER.CO.UK>
Subject: Re: Exiting from IML from within a macro?
I think there is syntax in IML to push a value into a macro variable. Set some value, quit IML
and then, in macro environment, test that value and %abort;
good luck
peterC
On Mon, 29 Aug 2011 14:34:13 -0700, Sprague, Webb (OFM)
<Webb.Sprague@OFM.WA.GOV> wrote:
>Hi all,
>
>Is there any way (I don't think there is...) to abort a macro from
>within PROC IML? (In other languages, I would "raise an exception"
>which would propagate out of all the enclosing loops and functions.)
>
>As an example, something like this:
>
>%MACRO whatthe (IN);
> proc iml;
> if &IN. ^= 4.0 then do;
> print 'hope so';
> abort;
> end;
> x=3;
> print x;
> quit;
>%MEND;
>
>What happens with this is that SAS keeps processing, but IML has
>aborted, so "x=3" gives weird errors.
>
>I would happily settle for jumping out of the proc and regaining control
>after the quit statement. I would really like to just abort the macro
>altogether and %PUT something to the log.
>
>I am not particularly hopeful about getting my wishes here, but don't
>want to give up until I appeal to the ever helpful SAS-L ...
>
>Tx!
|