Announcement

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

  • Summing up individual-specific amount of variables

    Hi,
    I am trying to generate a household-specific monetary policy shock variable. Generally I have two data sets.
    One containing panel data on household level from 2004-2018. The other contains changes in euro swaps around ECB meetings which is my indicator of monetary policy shocks.
    Now I need to merge the two data sets. However, the households were interviewed at different points in time during the same year which means that HH1 that was interviewed in week 12 of 2004 and then again in week 20 of 2015 has experienced more monetary policy meetings than HH2 that was interviewed in week 12 of 2004 and then again in week 12 of 2005. Therefore, I have to sum up the changes in the Euro Swap for every HH individually from week x year t-1 to week x year t.

    Do you know any command that would allow me to sum up the HH-specific amount of meetings more efficiently than doing it manually for 6,000 observations for 14 years.

    Thank you,
    Fabienne Leibfarth

  • #2
    Show examples using -dataex-, per the FAQ, so we can know what the structures of your two data set are.

    Comment


    • #3
      As Mike points out, specific help would demand us really understand your data structure.

      However, when it comes to adding up things by individuals, you are almost certainly going to want to use something like

      bysort individual: egen totx=total(x)

      If you need it also by year you can simply do
      bysort individual year: egen totx=total(x)

      If it is more complicated than that, you may need to look at statsby or rangestat.

      Comment

      Working...
      X