Overview

In this chapter, you will learn step-by-step how to organize, generate, and modify variables. You will get to know the two main commands to create variables in Stata, generate and egen, and how to modify the display format and storage types of variables. The subchapters on binary, categorical, and system variables provide useful commands and functions which might simplify your variable generation. The subchapters on string, date, and random variables might only be relevant to you if you deal with these kinds of variables. All descriptions contain remarks on common mistakes, which are also summarized in the sub-chapter before the exercise.

You can download the complete do-file here: