Date: Wed, 23 Jun 2004 16:55:55 -0400
Reply-To: "Fehd, Ronald J. (PHPPO)" <RJF2@CDC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Fehd, Ronald J. (PHPPO)" <RJF2@CDC.GOV>
Subject: Re: %include with return code to calling program --> is this
possible?
Content-Type: text/plain; charset="US-ASCII"
> From: Sober Hi
> I am new to SAS.
>
> I am using version 6.12
>
> I would like to have one "batch-like" file called MyMain.SAS
> that has as pseduo-code:
>
>
> My Main.SAS
>
> rc = %include 'code1.sas';
this won't work because an %include ought to be at a statement boundary.
-- I say this even despite last week's thread about
how it can, in fact, be done,
in some admittedly bizarre test cases --
so:
%include 'code1.sas';
%Put SysErr<&SysErr.>;
you may wish to RTFM on the %SYSRC Autocall Macro
> /* rc = return code; 0 = success */
> if rc=0 then %include 'code2.sas;
> else put "program
> aborted due to error in file code1.sas";
I just posted code to do this last week
subject: tip conditionally execute %include
http://www.listserv.uga.edu/cgi-bin/wa?A2=ind0406C&L=sas-l&P=R1158
> ------------------------------
> Code1.SAS
> (a number of SAS statements, including PROC SQL)
> then a return statement
there are also some SQL macro variables to examine.
run a PROC Sql;
and then
%Put _automatic_;
Ron Fehd the macro maven CDC Atlanta GA USA RJF2@cdc.gov
If you want creative workers,
give them enough time to play.
-- John Cleese, comic actor (1939- )
... and read about return codes