Hi, In the code below min_stat, max_stat, and range are computed correctly, however, pc_stat doesn't work. data have;
do until (last.SO);
set have;
by unit SO;
min_stat = min(min_stat, distance);
max_stat = max(max_stat, distance);
end;
range = max_stat - min_stat;
pc_stat = (distance-min_stat)/range;
do until (last.SO);
set have;
by unit SO;
output;
end;
run; The data below shows the input, incorrect pc_stat_get and the desired pc_stat_want. The typical excel equation is:J2 =(D2-F2)/H2 where distance = D2, min_stat = F2, range = H2, and pc_stat_want = J2. Thanks. unit SO distance date min_stat max_stat range pc_stat_get pc_stat_want 2801 1114 61879.683 23-Jan-18 61879.68 69663.15 7783.464 1 0 2801 1114 65404.52 24-Jan-18 61879.68 69663.15 7783.464 1 0.45286225 2801 1114 66928.735 25-Jan-18 61879.68 69663.15 7783.464 1 0.64868958 2801 1114 69270.521 26-Jan-18 61879.68 69663.15 7783.464 1 0.94955639 2801 1115 61887.203 23-Jan-18 61887.2 69652.83 7765.627 1 0 2801 1115 65411.952 24-Jan-18 61887.2 69652.83 7765.627 1 0.4538911 2801 1115 66937.299 25-Jan-18 61887.2 69652.83 7765.627 1 0.65031401 2801 1115 69260.203 26-Jan-18 61887.2 69652.83 7765.627 1 0.9494404
... View more