Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: capturing the sizes of the sequences of countinous (uninterrupted) values equal to 1


From   massimiliano stacchini <[email protected]>
To   [email protected]
Subject   st: capturing the sizes of the sequences of countinous (uninterrupted) values equal to 1
Date   Wed, 30 Nov 2011 09:24:31 +0000 (GMT)

Dear users,


I have a huge dataset. The rows identify the person ID (i) (i=1,...,n) while in columns there are the reference dates TIME(t) (t=1,...,w). Each cells contain the value 1 or 0 (zero), alternatively.

I should create a variable (LENGTH) varying both over ID and TIME. 
For each i of ID(i) in t of TIME(t), LENGTH should captures the number of continuous (uninterrupted) values which are equal to 1 in the interval of cells starting from the reference data t of TIME and moving backwards to the previous reference dates.
In other terms , LENGTH should capture for each (i) of ID and for each (t) of TIME the number of s in T (t-s) identifying cells having values equal to 1 (i.e., the size of the sequence of uninterrupted 1 moving backwards to the previous reference dates).

Can you help me on how can I get this result with Stata?

Thanks


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index