Hi All, I am having a problem in generating the COUNT of missing values. Please see the below table. In the below table, I have the "HAVE" column, and I want a stata command to generate the"WANT" column. In the "WANT" column, I want to count the missing values from "HAVE", however, the count in the "WANT" column should always reset when there is a "5555555" value in the "HAVE" column. I hope that I have explained my problem.

any help would be much appreciated.

HAVE WANT
. 1
. 2
5555555 5555555
. 1
. 2
. 3
5555555 5555555
5555555 5555555
. 1
. 2
. 3
. 4
5555555 5555555