Statalist


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

st: Re: moving from Stata to Mata


From   <[email protected]>
To   [email protected]
Subject   st: Re: moving from Stata to Mata
Date   Tue, 16 Oct 2007 9:04:00 -0400

For the record, my point was that Tom might be better off creating variables in Stata and then using them as matrices in Mata.

Is a stata variable not a lot like a vector?

Daniel

-----Original Message-----

From:  Kit Baum <[email protected]>
Subj:  st: Re: moving from Stata to Mata
Date:  Tue Oct 16, 2007 6:27 am
Size:  1K
To:  [email protected]

Contrary to another poster's comment, st_view() will not help here.  
st_view allow you to access Stata's variables, not matrices or  
"vectors" (note that Stata does not have a vector data type; all  
"vectors" are matrices with a unit subscript on one dimension. Mata  
has true vectors, rowvectors and colvectors).

st_local
st_global
st_numscalar
st_matrix

allow you to do the same with Stata's macros, scalars and matrices.  
They all have one- and two-argument forms. The one-argument form  
allows you to access the Stata object; the two-argument form allows  
you to update the contents (or indeed create) the Stata object. See

help m4_stata

for a complete list of the functions of this nature.


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


On Oct 16, 2007, at 2:33 AM, statalist-digest wrote:

>
> If one is working with program or do file in Stata and wishes to move
> to Mata within the program to use a Mata function for a matrix or
> vector defined in the Stata program, is this possible?

*
*   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/


*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index