First, I would like to say thank you for your response. I probably mis-communicated the problem so, the output that I am getting is not quite right. It was giving me weekly output with abstinence marked. What I would like to do is to add the counter (labelled abs_yes) by whether it's on or off (1 vs 0) but sequentially. So for example, if the person has 2 days of off (abs_yes = 0), it would look like this: Obs id Abs start ends eventstart123 700 0 0 2 01/21/2013 700 1 2 15 01/23/2013 700 0 15 17 01/25/2013 In this example, I have recoded abs_yes to abs (in order to not change any variable names, per your suggestion). I'm assuming this requires some sort of lag function where I would track how many sequential days are on or off on the original (abs_yes)? If it helps, the eventstart variable is less important than the start and ends variable, which count the number of sequential days abstinence or smoking within an individual.
... View more