I'd like to create a count variable that incrementally counts successive observations until my counted variable is not equal to 1, and then restarts counting when the variable is equal to 1 again.
So here's my dataset:
date time turb
03/17/2008 1200 1
03/17/2008 1215 1
03/17/2008 1230 1
03/17/2008 1245 0
03/17/2008 1300 1
03/17/2008 1315 1
What I want is:
date time turb count
03/17/2008 1200 1 1
03/17/2008 1215 1 2
03/17/2008 1230 1 3
03/17/2008 1245 0 0
03/17/2008 1300 1 1
03/17/2008 1315 1 2
Any ideas for how to do this?
kellyv