Hi.
Can someone please explain why macro variable email is not resolving?
Here is some code the generates the WARNING.
Here is the resultant log
I have no doubt I am missing something obvious.
Kind Regards,
Asender...
Can someone please explain why macro variable email is not resolving?
Here is some code the generates the WARNING.
Code:
*** Program 1 ***;
%macro report1;
%let email = 1;
%inc dev(program2);
%mend report1;
%macro report2;
%let email = 2;
%inc dev(program2);
%mend report2;
data test;
run = 'YES';
run;
data _null_;
set test;
call execute('%report1');
call execute('%report2');
run;
*** Program 2 - This code is stored elsewhere***;
%macro email020;
%if &email = 1 %then %do;
%put THIS RESOLVED AT 1;
%end;
%else %if &email = 2 %then %do;
%put THIS RESOVLED AT 2;
%end;
%put _user_;
%mend email020;
%email020;
Here is the resultant log
Code:
1 *** PROBLEM 1;
2
3 %macro report1;
4 %let email = 1;
5 %inc dev(program2);
6 %mend report1;
7
8 %macro report2;
9 %let email = 2;
10 %inc dev(program2);
11 %mend report2;
12
13 data test;
14 run = 'YES';
15 run;
[COLOR=blue]NOTE: The data set WORK.TEST has 1 observations and 1 variables. [/color]
[COLOR=blue]NOTE: The DATA statement used 0.02 CPU seconds and 10536K. [/color]
16 data _null_;
17 set test;
18 call execute('%report1');
19 call execute('%report2');
20 run;
MPRINT(REPORT1): %inc dev(program2);
MPRINT(REPORT2): %inc dev(program2);
[COLOR=blue]NOTE: There were 1 observations read from the data set WORK.TEST. [/color]
[COLOR=blue]NOTE: The DATA statement used 0.01 CPU seconds and 10556K. [/color]
[COLOR=blue]NOTE: CALL EXECUTE generated line. [/color]
1 + %inc dev(program2);
[COLOR=blue]NOTE: %INCLUDE (level 1) file DEV(program2) is file
ACTUXK2.SAS.DEVLIB(PROGRAM2). [/color]
21 +*** PROGRAM2;
22 +%macro email020;
23 + %if &email = 1 %then %do;
24 + %put THIS RESOLVED AT 1;
25 + %end;
26 + %else %if &email = 2 %then %do;
27 + %put THIS RESOVLED AT 2;
28 + %end;
29 + %put _user_;
30 +%mend email020;
31 +%email020;
[COLOR=green]WARNING: Apparent symbolic reference EMAIL not resolved.[/color]
[COLOR=red]ERROR: A character operand was found in the %EVAL function or %IF condition
where a numeric operand is required. The condition was: &email = 1 [/color]
[COLOR=red]ERROR: The macro EMAIL020 will stop executing.[/color]
[COLOR=blue]NOTE: %INCLUDE (level 1) ending. [/color]
2 + %inc dev(program2);
[COLOR=blue]NOTE: %INCLUDE (level 1) file DEV(program2) is file
ACTUXK2.SAS.DEVLIB(PROGRAM2). [/color]
32 +*** PROGRAM2;
33 +%macro email020;
34 + %if &email = 1 %then %do;
35 + %put THIS RESOLVED AT 1;
36 + %end;
37 + %else %if &email = 2 %then %do;
38 + %put THIS RESOVLED AT 2;
39 + %end;
40 + %put _user_;
41 +%mend email020;
42 +%email020;
[COLOR=green]WARNING: Apparent symbolic reference EMAIL not resolved.[/color]
[COLOR=red]ERROR: A character operand was found in the %EVAL function or %IF condition
where a numeric operand is required. The condition was: &email = 1 [/color]
[COLOR=red]ERROR: The macro EMAIL020 will stop executing.[/color]
[COLOR=blue]NOTE: %INCLUDE (level 1) ending.[/color]
I have no doubt I am missing something obvious.
Kind Regards,
Asender...