Try this. Should perform reasonably.
Feel free to ask 🙂
data temp;
format ID formula score;
merge have
have (firstobs = 2 keep = score rename = score = s);
if score = . then do;
f = formula;
i = ID;
end;
if score then f = tranwrd(f, strip(ID), put(strip(score), 8.));
if s = . then do;
formula = compress(f);
ID = i;
score = input(resolve('%sysevalf('||formula||')'), best8.);
output;
end;
retain f i;
keep ID formula score;
format score2 8.2;
run;
Result:
ID formula score
KRI1 1/10 0.1
KRI4 (13-16)*100 -300
KRI7 (13+16)/(1-10) -3.22222
... View more