Hi all,
I have panel data with date of birth (dt_birth), date of conception (dt_conception), gestational length (weeks_gestation and days_gestation), and daily exposure to smoke. The exposure data is aligned with the date of birth. That means that the value in that row means that the smoke was measured in date of birth.
The data looks like this:
Well, what I need is to calculate the average smoke exposure between conception and birth. I tried to use
but it didn't work.
It's important to highlight that as I have repeated measures (several births with different gestational ages on the same day). So I need that it calculates the exposure per row (case) and not per day of birth only.
Any ideas on how I could do this?
Thank you in advance.
I have panel data with date of birth (dt_birth), date of conception (dt_conception), gestational length (weeks_gestation and days_gestation), and daily exposure to smoke. The exposure data is aligned with the date of birth. That means that the value in that row means that the smoke was measured in date of birth.
The data looks like this:
Code:
egen mean_smoke = mean(inrange(dt_conception - dt_birth) * smoke)
It's important to highlight that as I have repeated measures (several births with different gestational ages on the same day). So I need that it calculates the exposure per row (case) and not per day of birth only.
Any ideas on how I could do this?
Thank you in advance.
Comment