Skip to content

Instantly share code, notes, and snippets.

@larsvilhuber
Last active November 25, 2025 20:41
Show Gist options
  • Select an option

  • Save larsvilhuber/d8b643a408d425ef2a80385b6377870d to your computer and use it in GitHub Desktop.

Select an option

Save larsvilhuber/d8b643a408d425ef2a80385b6377870d to your computer and use it in GitHub Desktop.
Generic minimal AEA-specific config
// insert this near the top of your main/master/run.do
*======== AEA specific parts =============**
local scenario "B" // Scenario B: main is in project top-level directory
local pwd : pwd // This always captures the current directory
if "`scenario'" == "A" { // If in Scenario A, we need to change directory first
cd ..
}
// Now capture the directory to use as rootdir. Do not change this in the submitted version!
global rootdir : pwd
// If setting it dynamically does not work for you (double-clicking on the main.do file)
// then set the rootdir explicitly. But leave this commented out when submitting.
// global rootdir "/path/to/myproject"
display in red "Rootdir has been set to: $rootdir"
// Go back to where we were before
cd "`pwd'"
/* install any packages locally */
di "=== Redirecting where Stata searches for ado files ==="
capture mkdir "$rootdir/ado"
adopath - PERSONAL
adopath - OLDPLACE
adopath - SITE
sysdir set PLUS "$rootdir/ado/plus"
sysdir set PERSONAL "$rootdir/ado" // may be needed for some packages
sysdir
ado
**======== End of AEA specific parts =============**
// Use this code to install packages, if you do not yet have your own code.
// If your code works, continue using it, but do not re-install packages.
local ssc_packages ""
// Example:
// local ssc_packages "estout boottest"
// If you have packages that need to be unconditionally installed (the name of the package differs from the included commands), then list them here.
// examples are moremata, egennmore, blindschemes, etc.
local ssc_unconditional ""
/* add packages to the project */
display in red "============ Installing packages/commands from SSC ============="
display in red "== Packages: `ssc_packages'"
if !missing("`ssc_packages'") {
foreach pkg in `ssc_packages' {
capture which `pkg'
if _rc == 111 {
dis "Installing `pkg'"
ssc install `pkg', replace
}
which `pkg'
}
}
/* add unconditionally installed packages */
display in red "=============== Unconditionally installed packages from SSC ==============="
display in red "== Packages: `ssc_unconditional'"
if !missing("`ssc_unconditional'") {
foreach pkg in `ssc_unconditional' {
dis "Installing `pkg'"
ssc install `pkg', replace
}
}
/*==============================================================================================*/
/* If you need to "net install" packages, add lines to this section */
* Install packages using net
* net install grc1leg, from("http://www.stata.com/users/vwiggins/")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment