On Fri, Jun 5, 2009 at 7:53 AM, Nick Cox<[email protected]> wrote:
> This isn't a reshape-like problem in my book, as no overall change to data structure or shape is needed: you just want new identifier variables.
I stand corrected.
> In the example -id- was just equivalent to observation number. In that circumstance
>
> gen ID_1 = ceil(_n/3)
>
> is an alternative, as are
>
> egen id__1 = seq(), block(3)
> egen id__2 = seq(), to(3)
>
> The first is easy to think about: you are just rounding up 1/3, 2/3, 3/3, 4/3, ... to the next integer.
Yes, this is simple and clever.
> The second two are just wrappers for trickery with -mod()- and -int()-. (I think -egen, seq()- predates -ceil()-.)
>
> Nick
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/