Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • st_matrix() unable to set ereturn matrices

    According to its help file, st_matrix(string scalar name, real matrix X) ". . . allow[s] name to be . . . c. e() matrix such as "e(V)".

    Nevertheless, using Stata 18.0 MP updated to 2024-12-18, it seems that I cannot set ereturn matrices from Mata.
    Code:
    mata
    B = 1, 2, 3, 4
    st_matrix("B", B)
    st_matrix("e(b)", B)
    The first st_matrix() in the code above executes without any problem, but the second one aborts with
    ÿÿÿÿÿÿÿÿÿÿÿÿÿst_matrix():ÿÿ3300ÿÿargumentÿoutÿofÿrange
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ<istmt>:ÿÿÿÿÿ-ÿÿfunctionÿreturnedÿerror

    r(3300);


    What am I doing wrong?

  • #2
    It's documented in the cited help file:
    6. Neither st_matrix() nor st_replacematrix() can be used to set, replace, or delete special Stata e() matrices e(b), e(V), or e(Cns). Only Stata commands ereturn post and ereturn repost can be used to set these special matrices; see [P] ereturn. Also see [M-5] stata() for executing Stata commands from Mata.

    Comment


    • #3
      Thank you, Daniel.

      I read it as far as I needed to, or so I thought.

      Comment

      Working...
      X