This lesson is in the early stages of development (Alpha version)

Economics Lesson with Stata: Glossary

Key Points

Read and Explore Data
  • Always write out filename extensions to avoid confusion.

  • Always use forward slash / in path names.

  • Use short and descriptive variable names.

  • Label your variables.

Data Formats and Data Quality
  • Use the missing value feature of Stata, not a numerical code.

  • Test for missing values with the missing function.

  • In Stata expressions, missing values are greater than any number. Functions of missing values are missing value.

  • Check CSV files for separator, variable names, and character encoding.

Transform Data
  • Drop unnessecary variables freely.

  • Reshape your dataset to create tidy data.

  • Use egen to save statistics to new columns, collapse to aggregate the entire dataset.

Combine Data
  • Create tidy data before merging.

Save and Reuse your Work in .do Files
  • Add commands to a .do file.

  • Run .do files en bloc, not by parts.

  • Check what directory you are running .do files from.

Repeat Tasks with Loops
  • Do not copy-paste your own code.

  • Use for loops to automate anything that happens more than twice.

Advanced Programming Topics
  • Use return list after a command to see what you can reuse.


Additional resources