Announcement

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

  • Issues with matrix and macro in stored results having the same name

    I am trying to export a matrix from a stored result after running a PCA (https://www.stata.com/manuals/mvpca.pdf) and subsequently a screeplot (https://www.stata.com/manuals/mvscreeplot.pdf), with the PCA producing e-class results while screeplot produces r-class results.

    My complication starts when I try to export a matrix of confidence intervals named r(ci), whilst it is also a name for the macro r(ci). Every time I want to use putexcel, it always returned a "type mismatch" error. The matrix r(ci) also returns only when I am using "matrix list" and not "matlist".

    Is the only way to export it is to copy-paste it manually?

  • #2
    Code:
    mata : st_matrix("ci", st_matrix("r(ci)"))
    BTW: I do not expect this situation. It is reported to tech-support.
    Last edited by Bjarte Aagnes; 25 Jul 2024, 04:27.

    Comment


    • #3
      Originally posted by Natan Widjaja View Post
      My complication starts when I try to export a matrix of confidence intervals named r(ci), whilst it is also a name for the macro r(ci).
      Seems like a design flaw in screeplot or even in return. The documentation states repeatedly that
      If your code has previously stored something in return(name), whether a scalar, matrix, or whatever else, the previous value is discarded and this result replaces it.
      I understand this to mean that different r() results cannot share the same name. Even if they technically can, I cannot think of a good argument that justifies this practice.

      Edit: Extracted and posted in a separate thread.
      Last edited by daniel klein; 25 Jul 2024, 04:25.

      Comment

      Working...
      X