My user-written commands/packages for data analysis in Stata
The included packages are:
exampleobsprints (randomly selected) example observations and optionally stores the values in a local macro. This is useful to explore possible values of a variable in your data set without being biased by the ordering of the data.
headprints the head observations (first observations in data set) and mimics the
head()function in R and
headcommand in Linux.
latexifyconverts matrix results to LaTeX tables row by row, for more flexible table creation than available from other packages.
randomselectrandomly selects observations and marks them with a dummy variable. It differs from
samplein that it does not drop the non-selected observations from the data set, and that either individual observations or other units, defined by a variable in the data set, can be randomly selected.
tailprints the tail observations (last observations in data set) and mimics the
tail()function in R and
tailcommand in Linux.
uniquevalscounts unique observations for a set of variables. The advantages of
uniquevalsover the popular user-written
uniquecommand (Hills and Brady, 1998) are that it is faster with big data sets especially when these are already sorted, and works with
byprefix (e.g., to show number of unique counties by state).
These packages can be downloaded directly through Stata using
ssc install <package_name>, replace
latexify are not yet available directly through Stata and do not yet include help file documentation.
event_study.dois a self-contained do file that generates an event study difference-in-differences graph.