Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: mata st_view() and change in Stata data

From   Kit Baum <>
Subject   st: mata st_view() and change in Stata data
Date   Thu, 30 Nov 2006 15:21:58 -0500

Bill Gould's posting offers useful advice, but missed the point of my earlier posting. His solution will not solve the problem at hand:

Solution: change

: a = a :+ t

to read

: a[.,.] = a :+ t

By the way, easier tyan typing

: t = (0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\70\0\0\0\0\0\0\0\0\0\0\0\0\0)


: t = J(rows(a), 1, 0)


You need to type

a[.,.] = a :+ t

rather than

a = a :+ t

because you want Mata to replace the elements of existing matrix a,
not redefine a.

But the original posted wants to do


and that is the equivalent of saying a = something. As my earlier posting pointed out, you cannot use _equilr on a view and expect to change the original variables (which was what prompted the original question).


Kit Baum, Boston College Economics
An Introduction to Modern Econometrics Using Stata:

* For searches and help try:

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