Dropping multiple observations

#1
Hi all,

I am working with panel data (many years, many countries) and I want to drop certain observations in two columns only, without deleting the rest of the observations in other columns. I tried keep if (transyear>2007 & transCountry==Afghanistan ) but it says it can't find Afghanistan!
 

Dason

Ambassador to the humans
#3
I don't know Stata but staassis's suggestion seems sensible. My guess is that it's looking for a column named "Afghanistan" to compare against (basically saying if column A is the same as column B where column A is "transCountry" and column B is "Afghanistan")
 
Last edited by a moderator:

hlsmith

Not a robit
#4
I skipped right to post #2 without reading post #1, only read the thread title. I initially thought #2 was Spam and starting LOL when I realized it was a legitimate suggestion based on incorporating parentheses.

Good stuff.

"Try 'Afghanistan'" is going to be my new default answer, though I don't want the g0v. tracking me too much based on a joke.