[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Phil Schumm <pschumm@uchicago.edu> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: extract rowname corresponding to row index of matrix |

Date |
Sat, 11 Apr 2009 07:41:37 -0500 |

On Apr 1, 2009, at 5:57 PM, Jacob Wegelin wrote:

Suppose we have a matrix BETA with -rownames- and -colnames-.Given the names of a row and of a column in BETA, it is possible toextract the indices of that row and of that column, as shown below.But is there an equally simple approach to the reverse problem? Imean: Given a row index, is there an elegant way to extract the nameof that row?

mata: string scalar getRowName(string scalar matname, real scalar row) { return(st_matrixrowstripe(matname)[row, 2]) } end

mata: getRowName("BETA", 5) -- Phil * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**st: extract rowname corresponding to row index of matrix***From:*Jacob Wegelin <jacob.wegelin@gmail.com>

- Prev by Date:
**Re: st: non-nested random effects** - Next by Date:
**Re: st: Statalist prob?** - Previous by thread:
**RE: st: extract rowname corresponding to row index of matrix** - Next by thread:
**RE: st: extract rowname corresponding to row index of matrix** - Index(es):

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