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

Re: st: Matrix subscripts using row and column names


From   [email protected] (Vince Wiggins, StataCorp)
To   [email protected]
Subject   Re: st: Matrix subscripts using row and column names
Date   Thu, 17 Jul 2003 12:47:05 -0500

Bill Gould <[email protected]> explained to West Addison <[email protected]>
why matrix expressions such as

        V["price","price"]

cannot be used in a scalar context.  While I agree complete with Bill's
explanation (I think I am required to by contract), West might be interested
in a "back door" way of evaluating the expression on one line.  Whereas the
matrix subscripting logic is geared toward efficiency, as Bill described, the
-rownumb()- and -columb()- functions are not so picky.  West's original
example,

    . generate sdif = dif / sqrt(V["price", "price"])

will not work.  However,

    . generate sdif = dif / sqrt(V[rownumb(V,"price"), colnumb(V,"price")])

will.


-- Vince
   [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/



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