Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

re: st: using vector notation to simplify coding


From   Kit Baum <baum@bc.edu>
To   statalist@hsphsun2.harvard.edu
Subject   re: st: using vector notation to simplify coding
Date   Wed, 12 Aug 2009 11:12:09 -0400

<>
Dan said

Thanks for the clarification, Kit. I am having trouble shaking the SAS mindset on this stuff, and your note, along with Michael's, have helped a lot. I "get" the mata approach, being a old Fortran guy ...it feels like a cumbersome solution in Stata right now, but I am sure that is a transitory feeling.

Actually it is a very elegant solution, taking advantage of the concept of 'view matrices' in Stata. Surely as another old Fortran guy you remember the EQUIVALENCE statement. That's what is happening with a view matrix (real programmers don't need no steenken pointers!) so that changes in Mata to the contents of the matrix (Y in my code) actually changes the contents of the Stata variables that populate the matrix. That is very powerful (and naturally can be dangerous if misunderstood).

See http://ideas.repec.org/p/boc/dsug09/06.html
(and ITSP, which illustrates this at greater length)

Cheers
Kit

Kit Baum   |   Boston College Economics & DIW Berlin   |   http://ideas.repec.org/e/pba1.html
An Introduction to Stata Programming | http://www.stata-press.com/books/isp.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/help.cgi?search
*   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