09-16-2012 09:11 PM
First of all my apologies if this question is simple, but it was hard to search for similar questions.
I have a dataset like this:
Column count equals either a or b, whichever is not missing; while dif is simply the difference between each observation in count and its lag value. My desired output is this:
This is to say, I want to keep only observations where a is not missing, while keeping dif value as it was. But once I use where a ne .; the new dif adjusts itself automatically (e.g. row 3 becomes 72 rather than 59). Any suggestions would be greatly appreciated.