Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Minimum of a vector or a matrix.


From   adiallo5@worldbank.org
To   statalist@hsphsun2.harvard.edu
Subject   st: Minimum of a vector or a matrix.
Date   Fri, 11 Nov 2005 09:28:35 -0500

Hi,

Is there a way to get the minimum value of a vector or a matrix?

Suppose :


A[3,3]
    c1  c2  c3
r1   0   2   3
r2   1   2   3
r3   3   1   5

I want to have:

B[3,3]
    c1  c2  c3
r1   1   0   1
r2   0   0   1
r3   0   1   0

where the 1s are true if the value in column j is the smallest.

Is there a way to combine (ie: the smallest value of the column
j AND of the corresponding line i)?

How also to get the smallest element of a matrix?

Another question:
Suppose the macro:
local mymacro 1 2 3 4 5 6 7 8 9 0
how to localise and index the smallest value of the macro?
I checked with macrolists but there is no answer.

Many thanks in advance.

Amadou B. DIALLO.
*
*   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