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, is already up and running.

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

st: Selecting within a subset of observations

From   Ada Keding <>
To   statalist <>
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 Keding
The University of York
*   For searches and help try:

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