Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
Attachment:
smime.p7s
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Dataset of means from the three largest values of a group
From
Iulian Ihnatov <[email protected]>
To
[email protected]
Subject
st: Dataset of means from the three largest values of a group
Date
Mon, 28 Nov 2011 22:03:07 +0200
Dear Statalisters,
I have the following dataset for the period of 1999 to 2010:
country year partner trade
AFG 1999 USA 12345
AFG 1999 DEU 9875
AFG 1999 FRA 25487
........................
AFG 2000 USA 5454
AFG 2000 HUN 5454
........................
HUN 1999 DEU 58744
........................
I need to create a dataset of means of the "trade" variable, grouped by
country and year, but only for the three largest observations of each group.
I may use - collapse (mean) trade, by(country year) -, but I don't know
how to isolate the largest three values from each group (in some years,
there are only 1 or 2 observations available, in others more than 10).
Any help would be highly appreciated.
--
Iulian Ihnatov
"Al.I.Cuza" University of Iasi
Description: S/MIME Cryptographic Signature