Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: creating count within id & date


From   Richard Williams <[email protected]>
To   [email protected]
Subject   Re: st: creating count within id & date
Date   Sun, 27 Feb 2005 00:21:13 -0500

At 04:02 PM 2/27/2005 +1100, Richard Hiscock wrote:
Dear Statalist,

I have the following data structure

id date var1 var2

1 16267 x 53
1 16267 y 106
1 16267 y 84
1 16267 y 90
1 16267 z 76
1 16267 z 65
1 16298 x 87
1 16298 y 76
2 15678 x 98
2 15678 y 98
2 16541 x 150

etc
I wish to create identifier (visitno) 1,2,3,... for each sequential date within id.
Your code seemed fine to me, so it isn't clear to me what you want. Could you indicate how you want the above records to be coded? Also, would it just be a matter of adding the -stable- parameter to sort?

*
* 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/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index