I've already suggested -egen, total()-
as a way of doing this. Why not try it
or explain why it is not what you want?
Nick
[email protected]
Dndee (plus three other posts)
> I need expression and commands to tell STATA;
> If "id" is the same as previous observation and if
> "in" for this observation equals to "out" in previous
> one, then add " stay" to previous one to calculate
> StayEachVisit. And consider that number of
> observations for total stay in each visit is not
> defined (in the example it is 1-2 but it can be one
> 1-7 or more).
*
* 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/