Hello, I have a most likely banal question. I have a database of about 400 000 observations which contains the following information:
A missing value means that the person is alive, so their age should not enter my calculation at all. I want to calulate the average age at death, but I don't know how to consider only one value for each ID and ignore the missing values. I assumed I needed to use the tag command, but I can't figure out exactly how.
For clarity, if the above data was my data, the value I need would be: average_age_at_death = (50 + 60)/2
ID | age_of_death |
1 | 50 |
1 | 50 |
1 | 50 |
2 | . |
2 | . |
3 | 60 |
For clarity, if the above data was my data, the value I need would be: average_age_at_death = (50 + 60)/2
Comment