I know I can use the drop and keep functions to clean my data, but what happens if I have a column and I just want to keep the data in it that equals two values
I want to drop all values that are not equal to either 100 or 200. So that my entire dataset has only countries represented by the numbers 200 and 100. I've tried using the code:
keep if country==100|200
But this deletes 0 observations. I tried using the following:
drop if race!=100 | 200
And this deleted ALL of the my observations.
I'm a bit confused here. Any help?
ID | country |
1 | 100 |
2 | 150 |
3 | 802 |
4 | 200 |
keep if country==100|200
But this deletes 0 observations. I tried using the following:
drop if race!=100 | 200
And this deleted ALL of the my observations.
I'm a bit confused here. Any help?
Comment