Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: RE: Creating repeated index
From 
 
TA Stat <[email protected]> 
To 
 
[email protected] 
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 <[email protected]> wrote:
> egen index = group(studentid visitdate)
>
> Nick
> [email protected]
>
> 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/