Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: matrix row/col names


From   Christopher F Baum <[email protected]>
To   [email protected]
Subject   st: Re: matrix row/col names
Date   Thu, 4 Sep 2003 07:52:15 -0400

On Thursday, September 4, 2003, at 02:33 AM, John wrote:

I've got two related questions regarding column and row names.
(1) How can I replace the 'jth' column name only?
(2) How can I save as a macro the 1st j column names from a matrix?

Many thanks.

- --John
Answering in reverse order (see [p] macro extended functions):

. qui regress price mpg headroom trunk

. mat v=e(V)

. local names: colnames v

. di "`names'"
mpg headroom trunk _cons

. local names: subinstr local names "trunk" "elephant"

. di "`names'"
mpg headroom elephant _cons

. mat coln v= `names'

. mat list v

symmetric v[4,4]
                 mpg    headroom    elephant       _cons
     mpg   4260.8406
headroom   1493.2491   234750.02
   trunk   3156.2153  -29562.132   11500.405
   _cons  -138633.33  -327787.03  -136940.48     5910415

Kit

*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index