Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • summarizing values for a timeframe

    Hello alltogether,

    my very limited STATA experiences come to an end with the following problem:

    I have multiple daily observations for different COVID-19-related variables for all OECD-countries and for the time-frame April 2020 - October 2021. Now what I want to do is to build the average of let's say the 7-days-incidence for the time period of three months each for EVERY country. (average 7-days-incidence for the time April-June2020, June-August2020 and so on for Australia, Austria, Germany and so on)

    An idea of mine was to group the observations by country and by the timeframe and then build the mean but to be honest i don't know how.

    I hope I made my question clear enough

    Thanks in advance for the answer

    Best regards

    Vincent

  • #2
    I think i got it... i created groups for the timeframes with the command: replace time_period = x if inrange(date, mdy(xx,xx,xxxx), mdy(xx,xx,xxxx))

    and then built the average for each country for the timeframes with: bysort time_period countryname: egen average_7dayincidence=mean(7dayincidence)

    Comment

    Working...
    X