Hi everyone,

I have a question regarding the following. The values after 0.000254 (UPAVG) should be calculated by the following formula: UPAVG[_n] = ((UPAVG[_n-1]*13)+UPTEST[_n])/14. Hence, the value after the value 0.000254 of the variable UPAVG should be: 0.0003544 (= (0.0000254*13)+0.0016599894)/14)). The first value of 0.000254 is given. How to implement this in code such that the newly calculated values are added to the UPAVG variable and also taken into account in the formula to calculate the next value. See below for dataex.

Thank you so much in advance.

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(var14 UPDOWNTEST UPTEST DOWNTEST UPAVG)
1.18382 -.0005799532           0 .0005799532 .000254
1.18548  .0016599894 .0016599894           0       0
1.18648  .0010000467 .0010000467           0       0
1.18574 -.0007400513           0 .0007400513       0
 1.1854 -.0003399849           0 .0003399849       0
1.18575  .0003499985 .0003499985           0       0
1.18806  .0023100376 .0023100376           0       0
1.18961  .0015499592 .0015499592           0       0
1.19055  .0009399652 .0009399652           0       0
end