[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: RE: Column and row maximums
> I have a datasheet containing the following information (example)
> A B C D E F
> 1 2 3 4 5 6
> 2 8 5 4 9 6
> 3 5 7 8 6 1
> 7 4 5 6 8 1
> 2 4 6 4 1 6
> I need a command that will tell me what the highest number
> in column E is
> (in this example 9) and also return the value in column B
> for the same row
> (i.e. in this example 8).
What do you mean by "datasheet" or
"column"? A data set and a variable?
Or a matrix and a column thereof?
I guess the former. In any event, please use
standard Stata terminology when
You can have a single command that
does both of these if you write it
. su E, meanonly
. l B if E == r(max)
Note that e.g.
. findit row maximum
points to -egen-, which
would probably feature in
of this example is of interest
Also, in general, there may be
ties for maximum, meaning that
this question may have multiple
* For searches and help try: