*! version 1.0 18 Dec 2013

help for dotemplateR.Andrés Castañeda

dotemplate -- Creates an organized template for do-files

Syntax

Using dialog box

dotemplate

Using Stata regular syntax

dotemplate
, file(string) [
options]

Note: I highly recommend using the dialog box syntax rather than the regular
Stata syntax. Just type dotemplate in Stata and fill up the fields. The only
mandatory options if file(string) to provide the name of the file.

Sections

Help is presented under the following headings:

Description
Options
Examples

main
project(string) objective of the do-file

file(string) name of the do-file

author(string) author name

path(string) directory path where do-file will be placed

type(string) type of template. basic or complete

depend(string) institutions/s working for in the project

output(string) list of files produced with the do-file

sections(#) number of sections in do-file.default is 3.

steps(#) number of steps with sections.

log produced log file with the same name as the do-file

replace replace

Description

dotemplate Creates template for do-files. Two different type of template are provided.
dotemplate is useful for being organized as programmer and standardize do-files among a
team or group of programmers. If any of the options above is not specified, dotemplate
will request for them. The user could press Enter from the keyboard if no information
is desired to be prompted, or type in the Stata commands window the specific information.

Options

Main

project(string) Name of the project or objective of the do-files

author(string) Name of author. Default is the name stored in macro c(username)

file(string) Name of do-file to create

path(string) Directory path in which the do-file template will be created. Default is current
directory

type(string) Select between basic or complete type of template. default is complete

depend(string) Dependencies for which the project of the do-file is done.. if any.

output(string) Expected output from the do-file

sections(#) Estimated number of sections that do-file will have. If the number of sections is
greater or smaller than expected the user just have to add or erase as she needs. Default value is 3

steps(#) Estimated number of steps or sub-sections in each sections. This option might be seldom
used but in some cases it will be useful in case the user needs a guide to organize her do-files.

log In case user likes to work with log-file, dotemplate will create above the header and
just before the end the corresponding lines to create the log file. The name of the log-file will be
the same than the name of the do-file in text format.

Back to Sections

Examples

Basic

Create a basic template with only one sections and no specification of log-file. Example

dotemplate, project("Program to create Templates for do-file") ///
file(detemplate) ///
author(Andres Castaneda) ///
path("C:\data\personal") ///
type(basic)

complete

Create a complete template for do-file with four sections and 3 sub-sections. Lines for log-file are
specified. type(complete) is not necessary since it is the default option. Example

dotemplate, project("Program to create Templates for do-file") ///
file(detemplate) ///
author(Andres Castaneda) ///
path("C:\data\personal") ///
depend(The World Bank-LCSPP) ///
output(dotemplate.ado) ///
sections(2) ///
steps(2) ///
log

Author

R.Andrés Castañeda

Development Economics, Data Group |
PovcalNet Team

The World Bank|1818 H St. N.W., Washington, D.C. 20433

Email: acastanedaa@worldbank.org

GitHub: randrescastaneda

Website: randrescastaneda.rbind.io

Source

you may find the source code in the Github repository
/randrescastaneda/dotemplate

Example of basic template

/*===========================================================================
project: Program to create Templates for do-file
Author: Andres Castaneda
Program Name: detemplate.do
---------------------------------------------------------------------------
Creation Date: December 20, 2013
===========================================================================*/

/*=========================================================================
0: Program Setup
===========================================================================*/

exit
------------------------------------------------------------------
Back to Sections

Example of complete template

capture log close
log using "C:\data\personal/detemplate.txt", replace text
/*===========================================================================
project: Program to create Templates for do-file
Author: Andres Castaneda
Program Name: detemplate.do
Dependencies: The World Bank-LCSPP
---------------------------------------------------------------------------
Creation Date: December 20, 2013
Modification Date:
version:
References:
Output: dotemplate.ado
===========================================================================*/

/*=========================================================================
0: Program Setup
===========================================================================*/
* Program Setup
version 12.1
drop _all

/*=========================================================================
1: <Describe>
===========================================================================*/

*------------------------ 1.1: <Describe> ----------------------------------

*------------------------ 1.2: <Describe> ----------------------------------

/*=========================================================================
2: <Describe>
===========================================================================*/

*------------------------ 2.1: <Describe> ----------------------------------

*------------------------ 2.2: <Describe> ----------------------------------

log close
exit

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

Notes:
1.
2.
3.

Version Control:

Back to Sections