|Date: ||Thu, 21 Sep 2006 20:05:32 -0400|
|Reply-To: ||"Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET>|
|Sender: ||"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>|
|From: ||"Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET>|
|Subject: ||Re: Macro will execute if macro variable contains some value other|
Kuladeep Mittapalli wrote:
> I have one Macro,Macro will send Mail to The mailer.
> I want,Macro should execute only when Macro variable contains some
> values other than no need to execute the macro.But the below code is
> not working...would you please help me in this issue.
Check the length of a macro variable to see if it contains anything.
A macro variable declared in a macro definition always exists in the macro
symbol table (detected with SYMEXIST). There is no guarantee the macro
variable will contain anything -- that depends on the caller.
%macro FOOBAR (ARG1=);
%if %length(&ARG1.) = 0 %then %do;
%put Hey Kuladeep, you called me with an argument that has no value;
%put ARG1 is &ARG1.;
* Note: ARG1 could be a macro quoted blank string, you should plan for worst
case scenarios when you distribute a macro to a user community beyond
Richard A. DeVenezia