I am trying to exclude items in a list for certain commands,
e.g. looking for data where is loc_state is listed with value that's not a US state
Of course, to this Stata simply replies, to each of my conditions individually that "not" is unrecognized.
How can I exclude the list items when running a command? What is the alternative to not? Or do I simply have the wrong syntax...should i be saying something like not(inlist(var,value,value))...
e.g. looking for data where is loc_state is listed with value that's not a US state
Code:
browse if not inlist(loc_state,"AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DC", "DE") & not inlist(loc_state,"FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY") & not inlist(loc_state,"LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT") & not inlist(loc_state,"NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH") & not inlist(loc_state,"OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT") & not inlist(loc_state,"VT", "VA", "WA", "WV", "WI", "WY")
How can I exclude the list items when running a command? What is the alternative to not? Or do I simply have the wrong syntax...should i be saying something like not(inlist(var,value,value))...
Comment