Statalist


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

st: Consistency in behavior of st_subview()


From   "Joseph Coveney" <[email protected]>
To   <[email protected]>
Subject   st: Consistency in behavior of st_subview()
Date   Tue, 19 May 2009 22:46:17 +0900

I take it that st_subview() doesn't play by the same rules when the referenced
matrix is a view created by st_view() as when it is a Mata matrix.  With the
latter, st_subview() behaves like select() with a second selection dimension.

Short of creating a set of temporary Stata variables as a buffer in which to
store the Mata matrix, is there a way to get st_subview() to behave toward a
native Mata matrix as it does toward a matrix created by st_view()?

Absent that, is there a way to create the analogue of an updatable view in SQL
for a Mata real matrix?

Joseph Coveney

: stata("quietly set obs 3")

: stata("generate byte a = 1")

: M = .

: st_view(M, ., 1, 0)

: Target = .

: st_subview(Target, M, 1, 1)

: Target[., .] = 10

: M
        1
    +------+
  1 |  10  |
  2 |   1  |
  3 |   1  |
    +------+

: M = J(3, 1, 1)

: st_subview(Target, M, 1, 1)

: Target[., .] = 10

: M
       1
    +-----+
  1 |  1  |
  2 |  1  |
  3 |  1  |
    +-----+

: end


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