help for qrowname and qcolname                                   (Roger Newson)

Extract lists of quoted row and column names from a matrix

qrowname matrix_name [ , noisily ]

qcolname matrix_name [ , noisily ]


qrowname returns lists of double-quoted row equations, row names and row full names for a matrix specified by matrix_name. qcolname returns lists of double-quoted column equations, column names and column full names for a matrix specified by matrix_name. The lists are stored in the saved results r(eq), r(name) and r(fullname), containing lists of quoted row/column equation names, quoted row/column names and quoted row/column full names, respectively. The two commands work similarly to the macro extended functions roweq, coleq, rownames, colnames, rowfullnames and colfullnames, but, unlike the macro extended functions, they return each name in double quotes. This is useful when row and column equations contain spaces or even single quotes, as sometimes happens with equation names for matrix estimation results generated by mlogit when the multinomial outcome variable has value labels. The returned lists can then be assigned to other matrices using the matrix roweq, matrix coleq, matrix rownames and matrix colnames commands.


noisily specifies that the lists will be echoed to the Stata log.


qrowname and qcolname will not fail if row and column names and/or equation names contain spaces and/or single quotes. Unfortunately, they will fail if a name contains an unpaired right double quote. Fortunately, this does not often happen in Stata, although it can be made to happen, by creating a string variable whose values contain unpaired right double quotes and then using encode to encode it to a numeric variable, which is then used as a multinomial outcome by mlogit.


. qrowname mickey . matrix roweq matti=`r(eq)'

. matr def vera=e(V) . qcolname vera,noi


Roger Newson, King's College, London, UK. Email: roger.newson@kcl.ac.uk

Also see

Manual: [P] matrix rownames, [P] matrix define, [P] macro On-line: help for matrname, matrix, macro, mlogit