# Ieddtab

`ieddtab`

is a Stata command that estimates and outputs differences in differences results in well-formatted tables. It is a useful command for conducting data analysis and exporting results in a reproducible manner. This page describes how to use the command and how it works.

## Read First

- This command is a part of the package
`ietoolkit`

. To install all the commands in this package including`ieddtab`

, type`ssc install ietoolkit`

in Stata. - For detailed instructions on how to implement the command in Stata, type
`help ieddtab`

in Stata.

## Overview

`ieddtab`

is a Stata command that estimates and outputs differences in differences results in well-formatted tables. To run `ieddtab`

in its most basic form, you need three variables: the outcome variable, a dummy variable that indicates treatment vs. control assignment and a dummy variable that indicates whether the observation comes from baseline vs. endline. In this example, these variables are varA, treat, and t, respectively. The basic implementation of the command is:

ieddtab varA, time(t) treatment(treat)

The command estimates five statistics for each outcome: the baseline means of the outcome for treatment = 0 and treatment = 1; the first difference regression coefficient of the outcome for treatment = 0 and treatment = 1; and the second difference. The baseline means represent the starting average for each group, the first differences represent the trend in each group between the two time periods, and the second difference represents the impact effect as estimated by a difference-in-difference model.

The command then outputs the results into a well-formatted table.

## How it Works

This section explains how `ieddtab`

estimates results, using the variables specified in the above example (varA, treat, t). The user does not need to know the following backend information in order to implement the command: this section is intended solely to enhance user understanding. Note that, for simplicity, any tempvars mentioned in this section are represented as normal variables.

The command first creates an interaction tempvar, which we call interact (line 1). The command then calculates the difference-in-difference result (line 2). The difference-in-difference result displayed in the table is the beta-coefficient of interact in the following regression. The command then creates a tempvar, which we call sample, that indicates which observations were included in the regression (line 3). The command then calculates the first differences for control and treatment, respectively (lines 4, 5). The first difference results displayed in the table are the beta-coefficients of time. Finally, the command calculates baseline means for control and treatment, respectively (lines 6, 7).

generate interact = t * treat regress varA time treat interact generate sample = e(sample) regress varA time if treat == 0 & sample == 1 regress varA time if treat == 1 & sample == 1 mean varA if time == 0 & treat == 0 & sample == 1 mean varA if time == 0 & treat == 1 & sample == 1

The tempvars are automatically deleted when the command ends.

## Back to Parent

This article is part of the topic ietoolkit

## Additional Resources

- Read more about
`ietoolkit`

here on GitHub