A nice template for your do-files: dotemplate

Introduction to dotemplate

If you want to have organized do-files and ado-files and/or stop scrolling up and down looking for a particular section of your long code, you may consider start using the Stata command dotemplate. Basically, this command creates a template for your do-files and ado-files so that you can start off your code on the right foot.

Once you’ve downloaded it, type dotempate in Stata and hit Enter. Then, you only need to fill up the dialog box with the information that you want to include in the header of your do-files and click OK. To open the just-created file, click the word ‘here’ in the results window of Stata. If you don’t want to fill up the fields in the dialog box, you could leave them all blank with the exception of the file name field. If you don’t select a directory, the file will be saved in the current directory of your Stata session.

For examples, when I fill the dialob box as shown the in the image bellow, the new template should look like this (notice that I selected ado-file instead of do-file, so the output is a little different):

project:       Example of dotemplate functionality
Author:        R.Andres Castaneda 
url:           randrescastaneda.rbind.io
Dependencies:  The World Bank
Creation Date:    28 Jun 2019 - 06:21:30
Modification Date:   
Do-file version:    01

              0: Program set up
program define dotemplate_example, rclass
syntax [], []
version 15.1






/* End of do-file */



Version Control:


You may download the stable version from SSC directly, ssc install dotemplate, or download the development version from Github. If you decide to go for the latter, I highly recommend you install the github command by E. F. Haghish (2019) by following the instructions here.


E. F. Haghish. 2019. “GITHUB:A Module for Building, Searching, Installing, Managing, and Mining Stata Packages from GitHub.” https://github.com/haghish/github.

R.Andres Castaneda. 2014. “DOTEMPLATE: Stata Module to Creates Templates for Do-Files.” Washington, D.C.: Boston College Department of Economics. https://ideas.repec.org/c/boc/bocode/s457782.html.

Economist/Data Scientist

My research interests include … matter.