I am looking for the appropriate syntax for extracting the maximum value from a matrix and storing it in a local variable for a traditional Stata .do file program.
For example, in the matrix:
matrix X = (1,2,3 \4,5,6\7,8,9)
the function should return the number 9.
I have looked in the Mata manual and found reference to the colmax
, colmin
and max
functions for Mata, but I can't seem to get them to work.