Dear Statalist users,
I have a dataset in long format - below is a sample
id pain-level
P001_1 0.2
P001_1 0.4
P001_1 .
P001_1 0.6
P002_1 .
P002_1 0.2
P002_1 0.3
P002_1 0.5
P002_1 0.7
For each set of IDs, there is a missing pain level.
How would I automatically fill in the missing value as the average of the other pain levels of the same ID?

Thank you.
Wilber