This seems like it should have a fairly easy solution, but I have not been able to find it. I want to keep every 2nd row in a data set I have, deleting each odd numbered row. The only way I can think to do this is to create an index spanning the whole set, then delete based on the index, but I'm unsure how to do that.
My usual warning about monotonic(), which may work in this case, but is not guaranteed to work in all cases... Any warning like this gives me something to worry about: http://support.sas.com/kb/15/138.html
A simple alternative (assuming that you are not doing anything other than a simple read and write with the data step program, so that _n_ will correspond to the number of obs in the data set).
orig_obs = _n_;
if mod(_n_,2) eq 0 then output;
Data _NULL_ is correct. _N_ is not a row index -- it is a count of loops through the data step program. Which is why I qualified what I said about using _N_ -- that as long as you were doing a simple read/write in your program you could use _N_. Because in that instance, _N_ will correspond to each observation, assuming that each observation is read with 1 loop of the DATA step program.
You could write DATA step programs to read more than one observation in a single loop of the program -- in which case, _N_ would cease to be a possibility. But in your case, assuming you have explained the problem as your program works -- with a simple read/write situation -- and you are only reading 1 observation for every loop through the program, then you can use _N_ as shown.