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

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…

Contents