LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 2003, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 22 Dec 2003 15:38:04 -0700
Reply-To:   Kenneth Moody <KennethMoody@FIRSTHEALTH.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Kenneth Moody <KennethMoody@FIRSTHEALTH.COM>
Subject:   Re: Bad %IF condition
Comments:   To: kviel@EMORY.EDU
Content-Type:   text/plain; charset=us-ascii

Kevin, If I recall correctly earlier posts by Ian W. have gone into detail on the circumstances when the SAS macro processor implicitly invokes %eval. When that is the case, comparisons to null macro variables fail with the message that you've received. Alternatives are to use macro quoting, which has the effect of masking the null macro value, or to use the alternate condition %length(&match) = 0

HTH, Ken

>>> "Kevin Roland Viel" <kviel@EMORY.EDU> 12/22/03 12:46PM >>> Macro oracles,

I have the following code which, despite &MATCH producing a value with a %PUT statements, yields this message:

ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: &Match.=

I have replicated this structure in a simplify test macro without producing the above mentioned thorn. If I use the statement %if %eval(%quote(&match.)=" ") all seems to go well. Any suggestions?

%if %sysfunc(exist(ds))=1 %then %do; %let Match=%str( );

data _null_; do until (match="1" | end); set ds end=end; if Directory="&path." then do; match="1"; call symput("Match", trim(Directory)); end; end; run;

%if &Match. = %str( ) %then %do; %end; /*This is the suspect line*/

Thanks,

Kevin

Kevin Viel Department of Epidemiology Rollins School of Public Health Emory University Atlanta, GA 30322


Back to: Top of message | Previous page | Main SAS-L page