Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Using stata local macro in mata
From
Benjamin Villena <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: Using stata local macro in mata
Date
Mon, 9 Sep 2013 11:20:12 -0700 (PDT)
Dear Stalist members,
My problem is as follows. I try to run a do file (let's call it rou.do) that contains
a mata routine using a parameter value kappa.
I would like to run rou.do several time using different values for kappa so
I built a forv loop such as
forv k=1/10{
do rou.do
}
In rou.do, the first lines read like this
mata
kappa = strtoreal(st_local("k"))
However, I cannot make mata to read the local k correctly. The mata code
crashes because of that. While debugging in mata, the value of kappa is
just missing (a dot)
If I do this directly in stata's command line by typing
local k=1
mata
kappa = strtoreal(st_local("k")),
kappa's value is 1.
What's wrong with my approach? How could I "import" a local macro in mata
correctly?
Thanks
Benjamín
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/