I am trying to create a variable that will flag (to a "1") when it hits a certain number (when there is improvement in a process). I am then trying to reset the baseline, so that a new baseline (threshold) has to be hit for it to be flagged. the data set starts off with just one variable (x). I create another one from the first observation called "baseline", so I will compare all other "x's" to baseline. once I hit a threshold, I want to change the baseline to the threshold it just hit.
here is the relevant part of the code (note I have already created code that determined baseline earlier in program).
data combo;
set combo;
if (baseline-x)/8 >1 then do;
flag=1;
baseline=x;
end;
else
flag=0;
run;
here is the relevant part of the output.
I am expecting flag to be 1 (which it is) for the third observation (because baseline started out at 259, then moved to 251 as I want it to. but why is flag=1 after that? The threshold is not met. can anyone help? thanks John

Aucun commentaire:
Enregistrer un commentaire