Announcement

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

  • Combining panel data into smaller panel data sets

    Hey,

    I have a panel data set with the mortality rates (smr) from different regions from 2003 to 2014. I want to combine the informations from all the regions in one state by using the mean. It is for an easier understanding of the data.

    The data already have an identifier for the state. So all regions for one state have the identifier bl=x and so on. Here is an example for my data. All regions have an id and all states have an id. Overall there are 16 states and the number of regions per state is different.
    time region id state id smr
    2003 1001 1 0,5
    - 1001 1 ..
    2014 1001 1 0,6
    2003 1002 1 0,4
    - 1002 1 ..
    2004 1002 1 0,5
    How do I create a new panel data with only the 16 states, the years and means of the smr for one state. So like this:
    time state id mean(smr)
    2003 1
    - 1
    2014 1
    2003 2
    - 2
    2014 2
    Thanks in advantage.

  • #2
    Code:
     collapse smr, by(state time)

    Comment

    Working...
    X