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 on April 23, and its replacement, statalist.org is already up and running.


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

st: Creating repeated index


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

Dear Stata Users

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

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