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

Re: st: Teething troubles in using -gen, mod()-


From   "Clive Nicholas" <[email protected]>
To   [email protected]
Subject   Re: st: Teething troubles in using -gen, mod()-
Date   Wed, 2 Feb 2005 23:42:14 -0000 (GMT)

Jean Ries replied:

> I think you should sort your data by id after expanding. In fact, the
> observations created by -expand- are added to the end of the data set.
> Try this:
>
> . expand 5
> . sort id
> . gen alt = mod(_n,5)

That sorted it (if you'll excuse the pun). Ta very much!

CLIVE NICHOLAS        |t: 0(044)7903 397793
Politics              |e: [email protected]
Newcastle University  |http://www.ncl.ac.uk/geps

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