Date: Mon, 14 Apr 2003 15:41:56 -0700
Reply-To: cassell.david@EPAMAIL.EPA.GOV
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "David L. Cassell" <cassell.david@EPAMAIL.EPA.GOV>
Subject: Re: SAS EMAIL in the if-then DO statement
Content-type: text/plain; charset=us-ascii
"Workman, Rob" <Rob.Workman@CARBOMEDICS.COM> sagely advised:
> Another option is to use macros if that is more familiar to you. Here
is an
> example.
>
> %macro eml(state);
>
> %if &state = TX %then
> %do;
> . . . . . .
While I never disagree with Rob (:-)) I will recommend here
that you write your code as
%if "&STATE." = "TX" %then
instead. I believe Ron Fehd was the first to point out in
SAS-L the dangers inherent in mixing state codes and macro code.
After all, what happens when your state is Oregon, or Nebraska?
Answer: Bad Things.
Your code becomes
%if &state = OR %then
and the macro compiler parses that as
%if (&state = ) or () %then
and you get a nasty but confusing error message. Since
Nebraska has NE (that's Not Equal) for its state code, it
can cause problems as well.
In addition, I thought I would point out that SAS does not handle
socket connections particularly well. So when there is a problem
with the connection to your Mail Transport Agent of choice, you
just get a failure with a cryptic error message. For this reason,
I still prefer to use Perl for my email processes, even when monitoring
SAS programs. I would also recommend Python for this task. Either
langauge has sufficient error-handling to allow you to deal with
email glitches.
HTH,
David
--
David Cassell, CSC
Cassell.David@epa.gov
Senior computing specialist
mathematical statistician