Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: RE: Creating repeated index


From   TA Stat <tastat@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: Creating repeated index
Date   Wed, 20 Oct 2010 22:57:38 +0700

It doesn't work. The index should start with "1" for every student.

Pete

On Wed, Oct 20, 2010 at 10:36 PM, Nick Cox <n.j.cox@durham.ac.uk> wrote:
> egen index = group(studentid visitdate)
>
> Nick
> n.j.cox@durham.ac.uk
>
> Pete
>
> I am trying to create an index/running number based upon same value of
> one variable, i.e., visit date.  Different visit date will have
> different index/running number.  I can do it by finding duplicates and
> drop them, then create an index and save as a new file, then merge a
> new file with the original one.  However, I want to know whether there
> is a short cut to do this.  My data will looks like this.
>
> StudentID     Visit Date     Item       Index
> 1                  1/1/2010        A            1
> 1                  1/1/2010        B            1
> 1                  2/4/2010        A            2
> 1                  2/4/2010        B            2
> 1                  2/4/2010        C            2
> 2                  4/1/2010        A            1
> 2                  4/1/2010        B            1
> 2                  4/1/2010        C            1
> 2                  3/3/2010        A            2
> 2                  3/3/2010        E            2
>
>
> *
> *   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/
>

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


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index