Raphael Fraser <[email protected]> asks,
> How can I format numerical elements within a matrix in Mata? Just as
> one would format a variable say, format price %9.2f.
Mata matrices do not carry formats. There are two solutions to dipslay a
matrix in formatted form.
First, you can write in Mata your own display loop:
for (i=1; i<=rows(X); i++) {
for (j=1; j<=cols(X); j++) {
printf("%9.2f ", X[i,j])
}
printf("\n")
}
Or, you can transfer the matrix to Stata and let Stata print it:
st_matrix("tmpX", X)
stata("matlist tmpX, ...")
st_matrix("tmpX, J(0,0,.))
The last line deletes the the matrix tmpX.
-- Bill
[email protected]
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/