Hello, I have been trying to figure out what I am doing wrong, but can't, so here I am posting the problem hoping someone can provide me some solution. The Problem: I have a IF statement within Do loop within DATA step. The IF statement evaluates by comparing Do loop index with a macro variable. Somehow the two values in comparison are not properly evaluated and thus, the codes always return ELSE values. %macro TEMP();
%do i = 1 %to &Sample.;
%do j = 1 %to &DD.;
/*some codes*/
%let dsid = %sysfunc(open(TEMP_0));
%let CNT_0 = %sysfunc(attrn(&dsid,NOBS));
%let CC = %sysfunc(close(&dsid));
%let dsid = %sysfunc(open(TEMP_00));
%let CNT_00 = %sysfunc(attrn(&dsid,NOBS));
%let CC = %sysfunc(close(&dsid));
/*some codes*/
data TEMP_0_; set TEMP_0_;
data TEMP_0_; set TEMP_0_;
do k = 1 to &CNT_0.;
if k <= &CNT_00. then Rand = 1; /*k and CNT_oo comparison is not properly evaluated*/
else Rand = 0; /* thus Rand is always 0*/
end;
drop k;
run;
/*some codes*/
%mend TEMP;
... View more