Good morning,
Would appreciate some help with the attached please.
In the wanted column the mean value of previous scores are required, grouped by animal.
There are some criteria for the mean calculation...
Grouped by animal
Mean of Previous ddates Only
Use score of walkmiles that are in excess of walkmiles for the current ddate only
example
10jan2024 - Walkmiles = 6 - therefore only scores with walkmiles in excess of 6 are used in the calculation. Which for the Dog are Scores of 9 + 8 + 7 = 24. The mean of which 8 is returned in the Wanted column.
Thanks
Would appreciate some help with the attached please.
In the wanted column the mean value of previous scores are required, grouped by animal.
There are some criteria for the mean calculation...
Grouped by animal
Mean of Previous ddates Only
Use score of walkmiles that are in excess of walkmiles for the current ddate only
example
10jan2024 - Walkmiles = 6 - therefore only scores with walkmiles in excess of 6 are used in the calculation. Which for the Dog are Scores of 9 + 8 + 7 = 24. The mean of which 8 is returned in the Wanted column.
Thanks
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float ddate str3 animal byte(walkmiles score) float wanted 23376 "Dog" 10 9 . 23377 "Dog" 10 8 . 23378 "Dog" 3 100 . 23379 "Dog" 1 100 . 23380 "Dog" 2 100 . 23381 "Dog" 4 100 . 23382 "Dog" 10 7 . 23383 "Dog" 6 100 . 23384 "Dog" 5 100 . 23385 "Dog" 6 100 8 23386 "Cat" 10 12 . 23387 "Cat" 10 11 . 23388 "Cat" 3 100 . 23389 "Cat" 1 100 . 23390 "Cat" 2 100 . 23391 "Cat" 4 100 . 23392 "Cat" 10 8 . 23393 "Cat" 6 100 . 23394 "Cat" 5 100 . 23395 "Cat" 6 100 . 23396 "Cat" 5 100 . 23397 "Cat" 8 100 13.67 end format %td ddate
Comment