Hello, I am struggling how to caculate average daily temperature duirng one year preceding study entry.
I have two datasets in Stata:
For each participant, I need to calculate the average daily temperature in the 365 days preceding their randomization date (i.e., from randomization_date - 365 to randomization_date - 1).
I would be grateful for any advice on this.
Best,
I have two datasets in Stata:
- Participants dataset
- One row per participant
- Variables:
- participant_id
- randomization_date
- Daily temperature dataset
- One row per day
- Variables:
- temp_date (covers 2014–2016)
- temperature (average temperature for that date)
For each participant, I need to calculate the average daily temperature in the 365 days preceding their randomization date (i.e., from randomization_date - 365 to randomization_date - 1).
I would be grateful for any advice on this.
Best,
Comment