Bookmark and Share

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]

st: RE: Creating repeated index


From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: RE: Creating repeated index
Date   Wed, 20 Oct 2010 16:36:10 +0100

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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index