From the course: Introduction to Stata
Unlock the full course today
Join today to access over 24,600 courses taught by industry experts.
Keeping and dropping variables - Stata Tutorial
From the course: Introduction to Stata
Keeping and dropping variables
- Keeping and or dropping data is a key activity of any data manipulation exercise. And Stata makes this process relatively simple. In this session, we'll explore how we can drop or keep certain observations and or variables and we'll also explore how we can store data temporarily. Do note, there is no back button in Stata. Executing these commands may lead to permanent changes in your data. Make sure you always work with a copy. We're going to introduce the keep and drop command that either keeps a set of observations or variables and we'll introduce the preserve and restore command which allow you to store and recall temporary data. So, let's head over to Stata and explore this using the auto data. Here will are in Stata with the auto data already preloaded. Let's begin by selecting variables. Imagine that we want to drop a specific variable from our data set. Let's make a price over here. To remove price, we can type…
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 6s
-
(Locked)
Keeping and dropping variables3m 8s
-
(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 6s
-
(Locked)
-
-
-
-
-
-
-