Thanks, Martin. - rowsort - does the trick, though the issue of missing
values is a pain but I can live with that.
Thank you again.
Shehzad
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Martin Weiss
Sent: 19 June 2008 13:29
To: [email protected]
Subject: st: RE: RE: RE: RE: maximum 3 and minmium 3 values
Actually, you got my suggestion right, but with 15.000 obs it is admittedly
not feasible. I bet other listers will provide a better suggestion.
Note, though, that -ssc d rowsort- can sort for each observation. After that
-keep- only the first three and last three columns and you have a perfect
dataset with your desired results...
Martin Weiss
_________________________________________________________________
Diplom-Kaufmann Martin Weiss
Mohlstrasse 36
Room 415
72074 Tuebingen
Germany
Fon: 0049-7071-2978184
Home: http://www.wiwi.uni-tuebingen.de/cms/index.php?id=1130
Publications: http://www.wiwi.uni-tuebingen.de/cms/index.php?id=1131
SSRN: http://papers.ssrn.com/sol3/cf_dev/AbsByAuth.cfm?per_id=669945
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Shehzad Ali
Sent: Thursday, June 19, 2008 2:26 PM
To: [email protected]
Subject: st: RE: RE: RE: maximum 3 and minmium 3 values
Thanks, Martin. In the xpose file, do you mean I should sort for each column
separately? If this is the case, then it will take forever with my 15,000
observations. Maybe I misunderstood your suggestion.
Shehzad
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Martin Weiss
Sent: 19 June 2008 12:17
To: [email protected]
Subject: st: RE: RE: maximum 3 and minmium 3 values
Admittedly, I jumped to an early conclusion as -egen- gives you the min and
max per observation, but you asked for the three smallest and largest
values. You could -save- your data, then -xpose, clear- which leaves you
with columns representing observations in the original data. Then -sort-
according to each column and extract the three highest and lowest values
into a -postfile-. Other listers may be aware of packages that automate this
task...
Martin Weiss
_________________________________________________________________
Diplom-Kaufmann Martin Weiss
Mohlstrasse 36
Room 415
72074 Tuebingen
Germany
Fon: 0049-7071-2978184
Home: http://www.wiwi.uni-tuebingen.de/cms/index.php?id=1130
Publications: http://www.wiwi.uni-tuebingen.de/cms/index.php?id=1131
SSRN: http://papers.ssrn.com/sol3/cf_dev/AbsByAuth.cfm?per_id=669945
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Martin Weiss
Sent: Thursday, June 19, 2008 12:50 PM
To: [email protected]
Subject: st: RE: maximum 3 and minmium 3 values
-egen , rowmin-
-egen , rowmax-
Martin Weiss
_________________________________________________________________
Diplom-Kaufmann Martin Weiss
Mohlstrasse 36
Room 415
72074 Tuebingen
Germany
Fon: 0049-7071-2978184
Home: http://www.wiwi.uni-tuebingen.de/cms/index.php?id=1130
Publications: http://www.wiwi.uni-tuebingen.de/cms/index.php?id=1131
SSRN: http://papers.ssrn.com/sol3/cf_dev/AbsByAuth.cfm?per_id=669945
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Shehzad Ali
Sent: Thursday, June 19, 2008 12:50 PM
To: [email protected]
Subject: st: maximum 3 and minmium 3 values
Hi listers,
I have a dataset with 11 variables for which I want to find out maximum 3
and minimum 3 values for each observation. I am aware that we can use
max(x1, x2..., xn) to get the first maximum or similarly first minimum.
Please advise on how to get subsequent maximum and minimum values.
Thanks,
Shehzad
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/