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: Selecting within a subset of observations


From   Ada Keding <[email protected]>
To   statalist <[email protected]>
Subject   st: Selecting within a subset of observations
Date   Thu, 13 Jun 2013 09:52:45 +0100

Dear all,

I am trying to use min/max or similar within a subset of observations.

For example, I have one or more event dates for different identifiers:

ID     EventDate
1      01/03/2011
2      31/01/2011
2      05/09/2011
3      12/03/2011

Now I would like to create a variable that displays the latest event
date within each identifier.

ID     EventDate       LatestEventDate
1      01/03/2011      01/03/2011
2      31/01/2011      05/09/2011
2      05/09/2011      05/09/2011
3      12/03/2011      12/03/2011

I have tried a number of long-winded ways using 'duplicates' but have
not found a solution yet.

Any pointers are much appreciated.

Many thanks,

Ada


Ada Keding
The University of York
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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