Stata code example developed for the course 2525: Applied Economics at Aarhus University (AU), Department of Economics and Business Economics.
Example on how to load data from .csv or .xlsx files.
Example on how to set up, combine, and export figures.
Example on how to export tables of descriptive statistics or estimation results to LaTeX, Excel, or Word.
Namely, I provide the same example in two separate do-files depending on your preferences:
- Stata example using Word
- Stata example using LaTeX (and pdf with outputs compiled using the code in the LaTeX folder)
In Danish, I explain the code in four videos with time codes.
Example on how to analyze panel data.
Your group can quickly get started writing collaboratively with LaTeX. It's a steep learning curve, but LaTeX is amazing for equations and all kinds of dynamic references compared to Word. That said, Word is far superior to Google Docs.
Aarhus University provides access to collaborative group work in Microsoft Office 365.
- At Office Online, you can open a new Word document or one existing on your OneDrive.
- "Share" access to the document with other AU e-mails or copy a link to it (loosen restriction such that anyone on AU with the link can edit).
- You can write within you browser or even do real-time editing in your desktop version of Microsoft Word (select "Redigering" → "Åbn i skrivebordsprogram").
- At OneDrive.live.com, you can share a folder with the rest of your group to ease access to the Word document and other files.
To handle LaTeX code, I highly recommend using the free Overleaf editor in your browser:
- Download the .zip file of my LaTeX article template (or the .zip file with LaTeX code for the pdf with outputs of the above Stata example).
- Create an Overleaf account
- Select "New Project" → "Upload Project" → add the .zip file.
- "Share" → add e-mail addresses of your other group members.
- Learn the basics
- Read the guide Learn LaTeX in 30 minutes .
- My setup is a bit more elaborate as the "main.tex" file uses the
\input{}
command to read files from the different folders.- Click on ">" next to the "preample" folder → open the "title_page.tex" file to edit title and authors.
- Click on ">" next to the "sections" folder → open "data.tex" or another file to start writing.
- CTRL+s saves your current file and recompiles the entire document. Do it often to catch compiling errors early.
- 📄🟥"Logs and output files" next to the 🔄🟩"Recompile" button can help you locate and debug critical code errors or you can out-comment recent code and uncomment it gradually (CTRL+' adds/removes
%
at the beginning of each marked line). After major debugging, it can be necessary to choose 🔄🟩"Recompile" → "Recompile from scratch" to clear the cache memory.
This repository is released under the MIT License, that is, you can basically do anything with my code as long as you give appropriate credit and don’t hold me liable.