Skip to content

Instantly share code, notes, and snippets.

@larsvilhuber
Last active May 27, 2022 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save larsvilhuber/c3dddbcf73e7534a22e3583b3422d7c5 to your computer and use it in GitHub Desktop.
Save larsvilhuber/c3dddbcf73e7534a22e3583b3422d7c5 to your computer and use it in GitHub Desktop.
Config file for Stata
// Derived from https://github.com/gslab-econ/template/blob/master/config/config_stata.do
// with minor corrections
clear all
set more off
program main
* *** Add required packages from SSC to this list ***
local ssc_packages ""
* *** Add required packages from SSC to this list ***
if !missing("`ssc_packages'") {
foreach pkg in `ssc_packages' {
* install using ssc, but avoid re-installing if already present
capture which `pkg'
if _rc == 111 {
dis "Installing `pkg'"
quietly ssc install `pkg', replace
}
}
}
* Install packages using net, but avoid re-installing if already present
*capture which yaml
* if _rc == 111 {
* quietly cap ado uninstall yaml
* quietly net install yaml, from("https://raw.githubusercontent.com/gslab-econ/stata-misc/master/")
* }
* Install complicated packages : moremata (which cannot be tested for with which)
capture confirm file $adobase/plus/m/moremata.hlp
if _rc != 0 {
cap ado uninstall moremata
ssc install moremata
}
end
main
/*==============================================================================================*/
/* after installing all packages, it may be necessary to issue the mata mlib index command */
/* This should always be the LAST command after installing all packages */
mata: mata mlib index
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment