# How can I drop observations when a variable is equal to any number from a sequence?

#### econlearner

##### New Member
I have a variable in a data set that has numbers between 0 and 1000. I want to drop observations where the variable is equal to any number from the sequence

S=42 + k*12

k=(0,infinity)

Right now the only way I know to do this is by typing out

drop if var == 42 | var == 54 | etc...

for all the numbers in the sequence, which is obviously not the best way to do it.

Could anyone provide help on an efficient way to do this?

Thanks!

#### bukharin

##### RoboStataRaptor
Re: How can I drop observations when a variable is equal to any number from a sequenc

This may not be the most efficient way but you could try:
Code:
drop if int((var - 42)/12)==(var - 42)/12 & (var - 42)/12>=0