Stata coding guide

My Stata Coding Guide describes how to set up a robust coding environment and write a “push-button” analysis that reproduces all results from raw data. The guide includes a companion replication package that can serve as a template for other research projects.

Multiple hypothesis testing

My Stata command wyoung (coauthored with Damon Jones and David Molitor) adjusts p-values for the number of hypotheses being tested. For usage instructions, follow the instructions and examples in the Stata help file or the wyoung GitHub repository. For details about the algorithm we employ, consult the technical documentation, which includes results from numerical simulations. See Jones, Molitor, and Reif (2019) for an example of how to use wyoung in research.

Software packages

Source code and installation instructions for all my software packages are available on GitHub. Stata packages can be installed using the ssc command. For example, type ssc install regsave, replace at the Stata prompt to install the regsave package. To install the latest version of all my Stata packages, execute the following code:

foreach cmd in appendfile autorename regsave rscript sortobs strgroup svret texsave wyoung {

  ssc install `cmd', replace
  
  * Uncomment the following line to install the latest developer's version
  *net install `cmd', from("https://raw.githubusercontent.com/reifjulian/`cmd'/master") replace
}

Package descriptions

Package Language Description

TextFileLoad

C++

TextFileLoad is an ANSI-compliant class that enables programs to import data from text files in a user-friendly manner. Data can be loaded by column name or number and are automatically converted to the appropriate data types.

appendfile

Stata

appendfile appends a text file to another text file.

autorename

Stata

autorename renames variables using a row of data. This can be useful when reading oddly formatted datasets.

regsave

Stata

regsave stores regression output into a Stata-formatted dataset.

rscript

Stata

rscript calls an R script from Stata.

sortobs

Stata

sortobs allows the user to sort observations by variable values or observation numbers.

strgroup

Stata/C

strgroup matches strings based on their Levenshtein edit distance.

svret

Stata

svret replaces the dataset in memory with the scalars and macros stored in e(), r(), and s().

texsave

Stata

texsave outputs the dataset currently in memory to a file in LaTeX format.

wyoung

Stata

wyoung controls the family-wise error rate when performing multiple hypothesis tests by estimating adjusted p-values using the free step-down resampling methodology of Westfall and Young (1993).