Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: RE: maximum 3 and minmium 3 values


From   "Martin Weiss" <martin.weiss@uni-tuebingen.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: maximum 3 and minmium 3 values
Date   Thu, 19 Jun 2008 13:17:13 +0200

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: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Martin Weiss
Sent: Thursday, June 19, 2008 12:50 PM
To: statalist@hsphsun2.harvard.edu
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: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Shehzad Ali
Sent: Thursday, June 19, 2008 12:50 PM
To: statalist@hsphsun2.harvard.edu
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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index