## Stata 15 help for matrix_rownames

```
[P] matrix rownames -- Name rows and columns

Syntax

Reset row names of matrix

matrix rownames A = names

Reset column names of matrix

matrix colnames A = names

Reset row names and interpret simple names as equation names

matrix roweq    A = names

Reset column names and interpret simple names as equation names

matrix coleq    A = names

where name can be

o a simple name;
o a colon followed by a simple name;
o an equation name followed by a colon; or
o an equation name, a colon, and a simple name.

and a simple name may be augmented with time-series operators and
factor-variable specifications.

Description

matrix rownames and colnames reset the row and column names of an already
existing matrix.

matrix roweq and coleq also reset the row and column names of an already
existing matrix, but if a simple name (a name without a colon) is
specified, it is interpreted as an equation name.

In either case, the part of the name not specified is left unchanged.

Examples

Setup
. mat A = (1,2,3\ 4,5,6\ 7,8,9)

List matrix A
. mat list A

Change row names of A to myrow1, myrow2, and myrow3
. matrix rownames A = myrow1 myrow2 myrow3

List the result
. mat list A

Change column names of A to mycol1, mycol2, and mycol3
. mat colnames A = mycol1 mycol2 mycol3

List the result
. mat list A

Prefix the column names of A with equation names eq1, eq2, and eq3
. mat coleq A = eq1 eq2 eq3

List the result
. mat list A

See how factor variables are incorporated in row or column names.  Here
rep78==1 is the base category
. sysuse auto
. regress mpg gear i.rep78
. matrix list e(b)

```