From the course: Introduction to Stata
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Indicator variables - Stata Tutorial
From the course: Introduction to Stata
Indicator variables
- [Instructor] In this session we're going to explore some of the ways that you can quickly generate indicator variables in Stata. These can also be referred to as dummy variables, binary variables, or qualitative variables. These variables are used for many purposes, and because they're used so often, Stata offers several ways to create them, and here, we'll take a look at some of these. Specifically, we'll use three commands that we've already introduced. We'll create a binary variable using the generate and replace commands. We refer to this as the old fashioned way because here we're going to spell everything out on separate lines of code. Then we'll take a look at the recode command and how we can use its generate option. And finally, we'll explore how we can use tabulate to quickly generate many dummy variables with its generate option. So let's set off to Stata. Here we are in Stata with the auto data…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Recoding an existing variable4m 3s
-
(Locked)
Generating a new variable5m 15s
-
(Locked)
Naming and labeling variables5m 20s
-
(Locked)
Extended generate3m 26s
-
(Locked)
Indicator variables4m 7s
-
(Locked)
Keeping and dropping variables3m 9s
-
(Locked)
Saving data3m 6s
-
(Locked)
Merging and appending6m 54s
-
(Locked)
String variables5m 53s
-
(Locked)
Local macros and looping7m 12s
-
(Locked)
Manipulating data: Challenge45s
-
(Locked)
Manipulating data: Solution4m 7s
-
(Locked)
-
-
-
-
-
-
-