Date: Wed, 5 Jan 2005 13:15:04 -0700
Reply-To: murff@byu.edu
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Michael Murff <mjm33@MSM1.BYU.EDU>
Organization: MSM
Subject: Re: macro: implicit %eval failure?
Content-Type: text/plain; charset="us-ascii"
Thanks Toby and Chang!
-----Original Message-----
From: Chang Y. Chung [mailto:chang_y_chung@HOTMAIL.COM]
Sent: Wednesday, January 05, 2005 12:54 PM
To: SAS-L@LISTSERV.UGA.EDU; Michael Murff
Subject: Re: macro: implicit %eval failure?
On Wed, 5 Jan 2005 12:44:17 -0700, Michael Murff <mjm33@MSM1.BYU.EDU>
wrote:
>Hi SAS-L,
>
>Could someone tell me what might be the problem with
>
> %if &yymm not eq 197601 %then %do;
>
>When I comment out this line (and corresponding %end), the macro runs
>error free.
>
>Thanks,
>
>Michael Murff
>Provo, UT
>
>
>695 /* appends a zero to one digit months */
>696 %macro twodgmn(month);
>697
>698 %if &month lt 10 %then 0&month;
>699 %else &month;
>700 %mend;
>701
>702 %let inIBESPath = c:\john\IBES\data\;
>703 options symbolgen mlogic;
>704 %macro RUreg(syr,eyr,smo,emo);
>705
>706 %do yr= &syr %to &eyr;
>707 %do mm=&smo %to &emo;
>708 %let yymm=&yr%twodgmn(&mm);
>709 %do fpi=1 %to 2;
>710 %put FD&fpi&yymm;
>711 %put *&yymm*;
>712 %if &yymm not eq 197601 %then %do;
>713 %if &fpi eq 2 %then %do;
>714 %put PD&yymm;
>715 %end;
>716 %end;
>717 %end;
>718 %end;
>719 %end;
>720 %mend;
>721
>722 %RUreg(1976,1976,1,2);
>MLOGIC(RUREG): Beginning execution.
>MLOGIC(RUREG): Parameter SYR has value 1976
>MLOGIC(RUREG): Parameter EYR has value 1976
>MLOGIC(RUREG): Parameter SMO has value 1
>MLOGIC(RUREG): Parameter EMO has value 2
>SYMBOLGEN: Macro variable SYR resolves to 1976
>SYMBOLGEN: Macro variable EYR resolves to 1976
>MLOGIC(RUREG): %DO loop beginning; index variable YR; start value is
>1976; stop value is 1976;
> by value is 1.
>SYMBOLGEN: Macro variable SMO resolves to 1
>SYMBOLGEN: Macro variable EMO resolves to 2
>MLOGIC(RUREG): %DO loop beginning; index variable MM; start value is 1;
>stop value is 2; by
> value is 1.
>MLOGIC(RUREG): %LET (variable name is YYMM)
>SYMBOLGEN: Macro variable YR resolves to 1976
>MLOGIC(TWODGMN): Beginning execution.
>SYMBOLGEN: Macro variable MM resolves to 1
>MLOGIC(TWODGMN): Parameter MONTH has value 1
>SYMBOLGEN: Macro variable MONTH resolves to 1
>MLOGIC(TWODGMN): %IF condition &month lt 10 is TRUE
>SYMBOLGEN: Macro variable MONTH resolves to 1
>MLOGIC(TWODGMN): Ending execution.
>MLOGIC(RUREG): %DO loop beginning; index variable FPI; start value is
>1; stop value is 2; by
> value is 1.
>MLOGIC(RUREG): %PUT FD&fpi&yymm
>SYMBOLGEN: Macro variable FPI resolves to 1
>SYMBOLGEN: Macro variable YYMM resolves to 197601
>FD1197601
>MLOGIC(RUREG): %PUT *&yymm*
>SYMBOLGEN: Macro variable YYMM resolves to 197601
>*197601*
>SYMBOLGEN: Macro variable YYMM resolves to 197601
>ERROR: A character operand was found in the %EVAL function or %IF
>condition where a numeric
> operand is required. The condition was: &yymm not eq 197601
>ERROR: The macro RUREG will stop executing.
>MLOGIC(RUREG): Ending execution.
Hi, Michael,
Try either:
foo ^= bar
or
foo NE bar
or
not (foo eq bar)
I don't know about the below, test it to see if it works.
foo not = bar
Remember that sas has many similar, but not exactly the
same, "expressions": one works in the data step; another works in the
where statement only; another in the sql; ... et cetra, et cetra, ...
Cheers,
Chang
|