Dropping values in Stata is achieved by the drop command. Let’s load the auto training dataset and create a new variable:
gen my_car = 0
tab my_car
That’s just a new variable with the value 0 for all observations in the dataset. Not very useful, so let’s drop it:
drop my_car
Another use case would be dropping missing values. The rep78 (repair records from 1978), for instance has some missing values in it:
misstable summarize
We can see that the variable rep78 has 5 missing values in it (denoted by .). Let’s drop these:
drop if rep78 == .
Now we can see that the missing values were dropped from the variable.