Announcement

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

  • Panel data 3 rounds: how do I count number of unique IDs for which a dummy=1 in none, one, two or all of the rounds

    Hello,
    I am struggling with a simple bit of summary statistics with panel data and wonder if someone can help.

    I have a balanced panel data set with time variable: round (1, 2, 3), and panel variable: id (generated by egen group(householdID))
    I have have a dummy variable: shock (1/0) , reported for each id for each round

    I would like to count and produce a table that reports the percentage of households/unique ids that experience 0 shocks, 1 shock, 2 shocks and 3 shocks, across the 3 rounds (I do not care whether shocks are consecutive, e.g. a household experiencing a shock in rounds 1 & 3 only I would count as having '2 shocks').

    Many thanks
    Annie

  • #2
    Welcome to the Stata Forum / Statalist

    Please read the FAQ. There you'll find important advice on sharing data/command/output.

    In short, you may use code delimiters or - dataex - for that matter.

    That being said, you'll probably need to use - egen - command.

    The reply was quite generical. A more precise reply demands workable data.
    Best regards,

    Marcos

    Comment

    Working...
    X