*! version 2.1.4

Title

boilerplate template main_g -- main project.do file

Description

This is a template for the main .do file in a project. This is the .do file that
calls all other .do files.

This is the only file that can use an absolute path. All
other .do files in the project must only use relative paths. That way, if you
want to share your project with someone else, or if you need to run it on another
computer, you only have to change the cd command in this file and it will run.

The three calls to sysdir will make sure that, for the duration of this
Stata session, Stata will look for community contributed packages in the ado
folder within this project folder. So when you start your project, and you have
run the first part of this .do file till cd ana you will find no community
contributed packages. You can just install what you need using either ssc,
net, or github, and those commands will install those packages in the
ado folder local to this project. This means that if you hand over your project
folder to someone else, that person will automatically also get the community
contributed packages you installed for this project.

Boilerplate

This template creates a .do file with the following content:

version <stata_version>
clear all
macro drop _all

// use only community contributed packages from
// the ado directory local to this project
cd "<proj_basedir>"
sysdir set PLUS "`c(pwd)'/ado/plus"
sysdir set PERSONAL "`c(pwd)'/ado/personal"
sysdir set OLDPLACE "`c(pwd)'/ado"
mata: mata mlib index

// set the working directory
cd ana

do <abbrev>_dta01.do // some comment
do <abbrev>_ana01.do // some comment

exit

Tags

This file may contain one or more of the following tags:

<stata_version> will be replaced by the Stata version

<date> will be replaced by the date

<fn> will be replaced by the file name

<stub> will be replaced by the file name without the suffix

<abbrev> will be replaced by the file name without the suffix up to the last underscore

<basedir> will be replaced by the directory in which the file is saved

<as of #> will include whatever comes after that tag only if the Stata version is # or higher

Source code

mp_main_g.mpb