Skip to content
Code to incorporate non-compete law changes using Stata, R and Python (Ewens and Marx (2017))
R Stata
Branch: master
Clone or download
Latest commit d6e6098 Nov 14, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md Small typos. Nov 14, 2018
createCNCvariables.R Initial commit Nov 13, 2018
createCNCvariables.do CT note. Nov 13, 2018
ncLawChanges.csv CT note. Nov 13, 2018

README.md

Incorporate non-compete law changes from Ewens and Marx (2017, RFS)

Ewens and Marx (2017) use a series of state-level law changes in the U.S. from 1995--2016 to study the impact of founder replacement on startup outcomes. The data and code below allow others to incorporate the law changes into their research.

CSV file (data)

The csv file contains four variables: year,state, cncChange and note_LawChange defined as:

  • year: the year of the law change. The best year to assume is treated years are those after this year.
  • state: two-letter abbreviation of state.
  • cncChange: -1 or 1 which represents the incremental change in the strength of the law change. -1 indicates a weakening, 1 indicates a strengthening, relative to the previous year.
  • note_LawChange: string containing notes about the change and whether it was used in the original study.

Stata code

The do file can be run in any program as do createCNCvariables.do after you update the two global variables in the file. The simple file creates the variable cncChange and note_LawChange for state-years with non-compete law changes. See above for variable definitions.

Alternatively, you can take the csv file and merge it into your data:

* your data is temp.dta
* Load up the csv and save as local tempfile
insheet using "stateYear.csv", comma clear
tempfile state_years
save `state_years'
* Load up your main data
use temp, clear
* Merge on the CNC law changes
merge m:1 state year using `state_years', keep(1 3) nogen

R code

The R file can be loaded with source and will add two new variables to your data cncChange and note_LawChange.

Alternatively, you can take the csv file and merge it into your data:

# Load the csv file
state_years <- read.csv("stateYear.csv", stringsAsFactors=FALSE)
# your data is currentData 
# Merge onto the current data.  Result is newData with new columns.
newData<- merge(state_years, currentData, by.x=c("state", "year"), by.y=c("state_yourData", "year_yourData"), all.y = TRUE)

Python code

Some sample code to import the csv file and merge onto your existing data:

import numpy as np
import pandas as pd

# Assume that you have currentData as your data with 'state' and 'year'
stateYear = read_csv("stateYear.csv")
newData = pd.merge(currentData,
                 stateYear,
                 on=['state','year'])

Citation

@article{ewensMarx2017founder,
  title={Founder replacement and startup performance},
  author={Ewens, Michael and Marx, Matt},
  journal={The Review of Financial Studies},
  volume={31},
  number={4},
  pages={1532--1565},
  year={2017},
  publisher={Oxford University Press}
}

Ewens, Michael, and Matt Marx. "Founder replacement and startup performance." The Review of Financial Studies 31.4 (2017): 1532-1565.

You can’t perform that action at this time.