-------------------------------------------------------------------------------
help for matnames
-------------------------------------------------------------------------------

Return matrix row and column names

Syntax

matnames [matrixname]

+-------------+ ----+ Description +------------------------------------------------------

matnames returns matrix row and column names as locals in r(). The macro extended functions that retrieve matrix row and column names (e.g. loc c: colnames b) do not quote the names, so that if names contain spaces, the number of tokens may not match the number of rows or columns (that is, you may not be able to rename the matrix rows or columns with its own names that you just retrieved). matnames uses the Mata functions st_matrixrowstripe and st_matrixcolstripe to circumvent this difficulty.

+----------+ ----+ Examples +---------------------------------------------------------

Cut and paste the entire block of example code to the Command window, or click on commands one by one to run:

mat b=J(2,3,1) mat rownames b="row x: item 1" "row y: item 2" mat colnames b="eq1: item 1" "eq1: item 2" "eq.2: item 3" mat li b mat c=J(2,3,0) matnames b ret li mat colnames c=`r(c)' mat rownames c=`r(r)' mat li c

Author

Austin Nichols Urban Institute Washington, DC, USA austinnichols@gmail.com

Also see

On-line: help for macro, matrix, st_matrixrowstripe, st_matrixcolstripe, etc.