Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Data Management


From   "Friedrich Huebler" <[email protected]>
To   [email protected]
Subject   Re: st: Data Management
Date   Thu, 27 Mar 2008 17:05:03 -0400

Raphael,

. bysort id: gen x = 1 if _n < 4
. replace x = 2 if x == .

Friedrich

On Thu, Mar 27, 2008 at 3:50 PM, Raphael Fraser
<[email protected]> wrote:
> I have 100 subjects with 6 obs each. I would like to create a new
>  variable containing 1s for the first three obs and 2s for the
>  remaining obs for each id.
>
>  Raphael
*
*   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