Announcement

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

  • Weird breaking change in Stata 16 with views, cross() and column indexing

    My package `elasticregress` has stopped working in Stata 16. I think the below code illustrates what has broken/changed:
    Code:
    // Create ten observations with a weight variable
    clear
    set obs 10
    generate weight = 1
    
    mata:
    // In Mata, create an x vector and load the weights into a view.
    x = J(10,1,1)
    w = J(10,1,1)
    st_view(w, ., "weight")     
    // The next two displays should be equivalent, but they are not. The first
    // returns 10 while the second returns a missing value.
    x_new = x[,1]
    display(strofreal(cross(x_new, w, x_new)))
    display(strofreal(cross(x[,1], w, x[,1])))
    end
    Note that the problem has something to do with the weights being loaded into a view. When I delete the st_view line, there is no problem.

  • Jeff Pitblado (StataCorp)
    replied
    Thanks to Wilbur's reproducible example, we will have this fixed very soon.

    Leave a comment:

Working...
X