Date: Wed, 3 Dec 2008 17:16:03 +0000
Reply-To: karma <dorjetarap@GOOGLEMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: karma <dorjetarap@GOOGLEMAIL.COM>
Subject: Re: avoid making macro just to use %if,
%then logic to selectively process code?
Content-Type: text/plain; charset=ISO-8859-1
If you are running the program in batch mode, putting the following
code at the start of the program should terminate it - and therefore
not run the remainder of your program - if the dataset of interest
doesn't exist, or has no values. In interactive mode, this will only
terminate the current datastep.
if ^(dsid or check) then
2008/12/3 Jennifer R. Holdcraft <email@example.com>:
> I have some SAS programs that do various processing and call "real" macros
> (I don't know how else to phrase it - I mean macros that actually have
> parameters that need to be submitted to them), but lately we've had some
> significant changes to the type of deals that we make (i.e. we always used
> to have options of certain commodities but they have expired and the group
> isn't making that kind of deal anymore - or at least not for a while -
> which is why I don't want to remove the code completely) and some programs
> are now failing because the incoming datasets are non-existent/empty.
> The only way I know to selectively process the code is to use %if %then
> type logic at the beginning to check to see if the incoming data exists or
> has 0 records and depending on the 1/0 result of this decide to process
> the code, or issue a %goto quit statement (quit is defined as quit: at the
> very bottom of the program) - and this necessitates the code being inside
> a macro. So I'm basically having to define a macro without any parameters
> around the code and then call this macro at the bottom of the program.
> Is there any way to do that checking of incoming datasets and selective
> processing of code without defining that "dummy" macro around it? It
> somehow seems ugly to me.
> Jennifer R. Holdcraft
> System Analyst, Market Risk Analytics
> American Electric Power
> 614-583-6761, Audinet 220-6761
> Cell: 614-307-4258