Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: compiling mata code

From   Oleksandr Shepotylo <>
Subject   Re: st: compiling mata code
Date   Fri, 13 Jan 2006 15:23:25 -0500

Actually, after experimenting with the code for a while I found that it stops when loading the saved matrix at this line:

mata matuse L:\FDI\Out\weights2rd

Does it mean that I can not load matrix inside the function?

Oleksandr Shepotylo wrote:


I want to write a mata function that will take an existing variable X from the loaded dataset,
multiply it by matrix W that also exist, and create a new stata variable Y=W*X .

I wrote a code included below which works fine when I substitute my arguments by real variable names "X" and "Y" but does not want to be compiled as it is.

function spatlag(string scalar index, string scalar windex)
mata matuse L:\FDI\Out\weights2rd
st_addvar("float", windex)
st_view(Y,., windex)
st_view(X,., index)
mata mosave spatlag(), dir(PERSONAL)

It stops at line: st_addvar("float", windex).

Any suggestions about what is wrong with my code?



* For searches and help try:
*   For searches and help try:

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