Statalist


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

RE: st: extract rowname corresponding to row index of matrix


From   Roy Wada <[email protected]>
To   <[email protected]>
Subject   RE: st: extract rowname corresponding to row index of matrix
Date   Sun, 12 Apr 2009 03:26:31 -0700

 
Yes, there is. See -help extended_fcn-

clear 
matrix input BETA=( 193\ 30 \ 133 \ 51\ 9.8 \ 0.1 )
matrix rownames BETA= dog cat rat mouse flea bubonic
matrix colnames BETA=IQ
mat lis BETA
 
di "row 2 of BETA is `: word 2 of `: rowname BETA''"

 
>
> But is there an equally simple approach to the reverse problem? I
> mean: Given a row index, is there an elegant way to extract the name
> of that row?
>
> The solution below seems clumsy. As seen with -matrix LostRowNames-,
> extracting a one-row matrix from a one-column matrix causes the
> -rownames- to be lost. Thus my program uses a column join, which seems
> like a kludge.
_________________________________________________________________
Quick access to your favorite MSN content and Windows Live with Internet Explorer 8. 
http://ie8.msn.com/microsoft/internet-explorer-8/en-us/ie8.aspx?ocid=B037MSN55C0701A
*
*   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/



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