Please explain why Time_To_Achieve_Target is 10 in the first line of the data you have posted. The maximum value is 9.8 in Week9.
The code i posted will need at one update if some week-variables don't exist. Changing the array-statement to
array values Week:;
should be sufficient, assuming that there are no variables in the dataset whose names start with "week" but must not considered in setting Time_To_Achieve_Target. And the variables must be properly sorted, if Week5 appears before Week4 the loop won't give the expected results.
... View more