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 <baum@bc.edu>
To   statalist@hsphsun2.harvard.edu
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)

is

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


Explanation
-----------

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

_equilr(a,r)

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

Kit Baum, Boston College Economics
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




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