Skip to content

Examples on exporting tables from Stata to LaTeX, Excel, or Word.

License

Notifications You must be signed in to change notification settings

thornoe/Stata_example

Repository files navigation

Stata example

Stata code example developed for the course 2525: Applied Economics at Aarhus University (AU), Department of Economics and Business Economics.

Load data

Example on how to load data from .csv or .xlsx files.

Figures

Example on how to set up, combine, and export figures.

Tables

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:

In Danish, I explain the code in four videos with time codes.

Panel analysis

Example on how to analyze panel data.

Collaborate on group projects

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.

Use Word in real-time

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.

Use LaTeX in real-time

To handle LaTeX code, I highly recommend using the free Overleaf editor in your browser:

  1. 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).
  2. Create an Overleaf account
    • Select "New Project" → "Upload Project" → add the .zip file.
    • "Share" → add e-mail addresses of your other group members.
  3. 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.

License

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.

About

Examples on exporting tables from Stata to LaTeX, Excel, or Word.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published