Dear all,
I am trying to create a variable that counts the number of nonmissing values
for another variable, but starts counting from the beginning when a missing
value is found.
In the folowing example I have an individual identifier (i) and a time
variable (t). I want to create var4 which counts the number of non missing
observations of x by I and t, but I want it to start counting when a missing
value appears on x.
+------------------+
i t x var4
------------------
1 1 1 1
1 2 0 2
1 3 1 3
1 4 . .
1 5 1 1
------------------
2 1 1 1
2 2 1 2
2 3 . .
2 4 0 1
2 5 0 2
+------------------+
Thanks in advance
Nikos
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/