eventshape

A stata program that reshapes data with multiple policy changes within a jurisdiction to be ready for event study analyses.

Installation

Install eventshape by opening Stata and running the command:

net install eventshape, from(http://kylerozema.com/eventshape)

The documentation for eventshape is included with the installation. To read the documentation, run the command:

help eventshape

Background

Event studies are powerful research designs when treatments are staggered in time across individuals or across other observations such as states. For example, imagine a state making a policy change on July 1, 2000 and another state making the same policy change on January 1, 2002. The fact that each state made the policy change at a different time is useful in terms of counterfactuals: we can use the treated states as counterfactuals for each other. We can exploit these changes to help identify short-term effects of the policy change on an outcome of interest. When the policy change occurs only once in a state, reshaping data for event studies is straightforward: define the event time as calendar time minus the date of treatment for each treated observation (i.e., where the date of the policy change becomes event time 0). In using event time under this definition, we are able to stack the data in a manageable way to then collapse the data and compute statistics of interest.

Technical Description

When policies change multiple times within one or more states, reshaping data for event studies is not straightforward. An application that comes up in my work is state cigarette tax changes. Since the early 1990s, some states have raised their cigarette tax more than five times. The issue with reshaping this data for an event study is that there are multiple “events” for each state, where an event is the change in the state‚Äôs cigarette tax. For researchers confronted with this and similar problems, eventshape is a solution. All one needs to do is follow these four simple steps: 1) rename the policy variable of interest (here, cigarette taxes) to policy; 2) rename the jurisdiction variable of interest (usually state) to juris; 3) make sure the date variable is denoted by a four-digit year variable named year and the one or two-digit month variable named month; and 4) execute the following command in stata: eventshape year month juris policy. That is it!
eventshape creates the following two variables: (1) event_time, which is the event time where the change in the policy in the jurisdiction is at event_time = 0; and (2) id, which is a unique identifier for each event within the event study, that is, it uniquely identifies each change in policy and the 6 months before and after the change in policy.

Notes:

(1) eventshape deletes all observations that are not within +/-6 months of a policy change.
(2) eventshape is only a one way conversion.
(3) Researcher may use the preserve and restore commands to convert data back to original data.

Example:

In the table on the right below, the dashed rows ( – – – – – – ) indicate that eventshape has deleted the observation.

Original Data (before eventshape)
state year month tax
________________________________________
MI 2005 9 0.5
MI 2005 10 0.5
MI 2005 11 0.5
MI 2005 12 0.5
MI 2006 1 0.5
MI 2006 2 0.5
MI 2006 3 0.5
MI 2006 5 0.5
MI 2006 6 1
MI 2006 7 1
MI 2006 8 1
MI 2006 9 1
MI 2006 10 1
MI 2006 11 1
MI 2006 12 1
MI 2007 1 1
MI 2007 2 1
MI 2007 3 1
MI 2007 4 1
MI 2007 5 1
MI 2007 6 1
MI 2007 7 1
MI 2007 8 1
MI 2007 9 1
MI 2007 10 2.8
MI 2007 11 2.8
MI 2007 12 2.8
MI 2008 1 2.8
MI 2008 2 2.8
MI 2008 3 2.8
MI 2008 4 2.8
MI 2008 5 2.8
MI 2008 6 2.8









eventshape
------------------>
Data after eventshape
state id event_time tax
________________________________________
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MI 1 -6 0.5
MI 1 -5 0.5
MI 1 -4 0.5
MI 1 -3 0.5
MI 1 -2 0.5
MI 1 -1 0.5
MI 1 0 1
MI 1 1 1
MI 1 2 1
MI 1 3 1
MI 1 4 1
MI 1 5 1
MI 1 6 1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MI 2 -6 1
MI 2 -5 1
MI 2 -4 1
MI 2 -3 1
MI 2 -2 1
MI 2 -1 1
MI 2 0 1
MI 2 1 2.8
MI 2 2 2.8
MI 2 3 2.8
MI 2 4 2.8
MI 2 5 2.8
MI 2 6 2.8
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -