I am trying to submit the following codes, but it always comes up with the error: ???
ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric
operand is required. The condition was: split-1
ERROR: The macro INFO will stop executing.
-------------------------------------------------------------------------------------------------
libname project 'F:\Courseinfo\fall2009\CS699\presentation';
%macro var_discret (var);
data pd_&var;
set project.pd_data_import (keep=&var status);
run;
proc sort data=pd_&var;
by &var;
run;
%macro info(split);
data _null_;
%let L_obs=%sysevalf(&split-1);
set pd_&var (firstobs=1 obs=&L_obs) end=lastobs;
if status=1 then count_yes+1;
else if status=0 then count_no+1;
if lastobs then do; p_yes=count_yes/&L_obs; p_no=count_no/&L_obs;entropy=-p_yes*log(p_yes)/log2-p_no*log(p_no)/log2;
call symput ('entropy_D1', trim(left(put(entropy,8.0)))); end;
run;
data _null_;
%let R_obs=%sysevalf(&split+1);
set pd_&var (firstobs=&R_obs obs=195) end=lastobs;
if status=1 then count_yes+1;
else if status=0 then count_no+1;
if lastobs then do; p_yes=count_yes/(196-&R_obs); p_no=count_no/(196-&R_obs);entropy=-p_yes*log(p_yes)/log2-p_no*log(p_no)/log2;
call symput ('entropy_D2', trim(left(put(entropy,8.0)))); end;
run;
%let info=%sysevalf((&L_obs/195)*&entropy_D1+((196-&R_obs)/195)*&entropy_D2);
%let previous_info=&info;
%mend;
%do split= 2 %to 194;
%info(split)
%if %sysevalf(&info lt &previous_info) %then %let final_split_pos_&var=&info;
%end;
%put "The final split point for variable &var is &split";
%mend;
%var_discret(MDVP_Fo)