I have a Mata function which looks as follows:
-------------------------------------lsq.mata--
(...)
// Mata Function to extract the substitution costs from subcost-matrix
void showhash(real rowvector R)
{
string scalar key1
st_local("key1",key1)
key1 = strofreal(R[1,2])
st_local("key1",key1)
stata("local hash1 = mod(`key1',197)")
}
(...)
------------------------------------------------
The function is part of the mata-libary lsq.mlib, which compiles without
problems. All other function in the library works well. However, if I run
-showhash()- from within Mata I got the following error:
: R = 2,3,5,4
: showhash(R)
invalid syntax
stata(): 3598 Stata returned error
showhash(): - function returned error
<istmt>: - function returned error
r(3598);
Further investigation showed that the error is connected to the -stata()-
function. However, After running -showhash()- I can intactively run the same
-stata()- function without any problems:
: stata("local hash1 = mod(`key1',197)")
: stata("display `hash1'")
3
Any thoughts on this?
cu
Uli
--
[email protected]
+49 (030) 25491-361
*
* 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/