------------------------------------------------------------------------------- help for ^matname^ [STB-24: ip6.2] ------------------------------------------------------------------------------- Rename the rows and columns of a matrix --------------------------------------- ^matname^ A namelist [^,^ ^r^ows^(^range^)^ ^c^olumns^(^range^)^ ^e^xplicit ] Description ----------- ^matname^ changes the row and columns names of an existing matrix A. namelist is either (1) a varlist, i.e., names of existing variables possibly abbreviated; (2) ^_cons^ and the names of existing variables possibly abbreviated; or (3) arbitrary names when the ^explicit^ option is specified. Note: Arbitrary names cannot be mixed with abbreviated variable names. ^matname^ differs from the ^matrix rownames^ and ^matrix colnames^ commands (see help for @matrix@) in that ^matname^ expands varlist abbreviations and also allows a restricted range for the rows or columns. Options ------- ^rows(^range^)^ and ^columns(^range^)^ specify the rows and columns of the matrix to rename. The range must be given in one of the following forms: ^rows(.)^ renames all the rows; ^rows(2..8)^ renames rows 2 through 8; ^rows(3)^ renames only row 3; ^rows(4...)^ renames row 4 to the last row. The number of rows or columns specified must be equal to the number of names in namelist. If both ^rows()^ and ^columns()^ are given, then the specified rows are named namelist and the specified columns are also named namelist. If neither ^rows()^ nor ^columns()^ is given, then ^rows(.)^ ^columns(.)^ is the default. That is, the matrix must be square, and both the rows and columns are named namelist. ^explicit^ suppresses the expansion of varlist abbreviations and omits the verification that the names are those of existing variables. That is, the names in the list are used explicitly and can be any valid row or column names. Examples -------- (1) Rename the rows ^length^, ^price^, ^foreign^, and ^_cons^ (matrix must be 4 x n): . ^matname A len pr for _cons, r(.)^ (2) Rename the rows and columns ^length^, ^price^, ^foreign^, and ^_cons^ (matrix must be 4 x 4): . ^matname A len pr for _cons^ (3) Rename columns 2 through 9 ^make^, ^mpg^, ^_cons^, ^displ^, ^gratio^, ^foreign^, ^_cons^, and ^mpg^ (matrix must be m x 9): . ^matname B m* _cons dis-for _cons mpg, c(2...)^ (4) Rename row 2 ^make^ and rename column 2 ^make^: . ^matname c make, r(2) c(2)^ (5) Rename row 8 ^notavar^, where ^notavar^ is not an existing variable: . ^matname D notavar, r(8) explicit^ (6) Rename row 2 ^eq1:make^ and row 3 ^eq1:mpg^; and also rename column 3 ^eq1:make^ and column 4 ^eq1:mpg^: . ^matname E eq1:make eq1:mpg, r(2..3) c(3..4) explicit^ Author ------ Bill Sribney, StataCorp EMAIL tech_support@@stata.com Also see -------- Manual: [6m] rowname, [6m] define On-line: help for @matrix@ STB: ip6.2 (STB-24)