Start a research project
From an empty folder to a finished paper, in six steps
This is the workflow I used as a research assistant at the Inter-American Development Bank and in my own research. Stata writes every table and figure straight into the paper’s folders, LaTeX lays out the paper, and Overleaf keeps co-authors on one version. When the data changes, you rerun the do-file and the paper updates. No more copying numbers by hand.
Organize your files
Every project has the same layout: data/ for raw data, working data, and code; project/ for the paper’s sections, tables, and figures; and main.tex to tie the paper together. Your code always knows where its output belongs.
project_template/
├── main.tex
├── data/
│ ├── original_data/
│ ├── working_data/
│ └── code/
│ ├── do_file_template.do
│ └── template_demo.do
└── project/
├── sections/
├── tables/
└── figures/
Clean your data with do-files
Write every cleaning step in a do-file instead of clicking through menus, so anyone can rerun it from the raw data. The top of the do-file template sets each folder path once, so no other line has a hard-coded path.
* Set Project Folder Paths
global data_dir "data\original_data\"
global work_dir "data\working_data\"
global table_dir "project\tables\"
global figure_dir "project\figures\"
template_demo.do in Stata’s do-file editor: one place for every path.Send tables straight to the paper
Regressions, summary statistics, and balance tables export as LaTeX files into project/tables/. Formats such as significance stars and decimal places are set once at the top, so every table matches.
global stars "star(* .10 ** .05 *** .01)"
eststo clear
eststo: reg dependent_var ///
independent_var control_var1
esttab using "$table_dir\reg_prices", ///
$reg_format $reg_decimal
reg_prices.tex into project/tables/. Overleaf renders it as a finished table.Learn just enough LaTeX
The paper is a set of short section files, and each table and figure is pulled in with one line. My tutorials change one command at a time, so you can see exactly what each one does.
\subfile{project/sections/5_results}
\include{project/tables/table_balance}
\includegraphics[width=1\textwidth]
{project/figures/graph_twoway.png}
graph_twoway.png, exported by the demo do-file and pulled into the paper with one line.do-file → project/tables/*.tex
git push → GitHub repository
Overleaf ⇄ syncs with GitHub
co-authors → edit in Overleaf
Use the template
On GitHub, click Use this template to start a new project with all of the above already set up. The Instructions folder has a step-by-step tutorial with screenshots.