Dropping observations in Stata

April 30, 2019

Dropping observations in Stata is easy. Looking at the nlsw88 training dataset for instance, let’s say we’d want to narrow the survey to only include respondents from the south. In order to do so, we’d simply drop the observations representing non-southerners:

drop if south == 0  
summarize  

Result of dropping observations

As we can see from that operation, 1304 observations was dropped and consequently we are left with only southern survey takers in the dataset.

In order to undo, just reload the dataset.


Profile picture

Written by Johan Osterberg who lives and works in Gothenburg, Sweden as a developer specialized in e-commerce. Connect with me on Linkedin

2024 © Johan Osterberg