Hi,
I am having trouble saving to locals using Mata. The following ADO code demonstrates my problem:
***example.ado code***
program example
version 9.2
mata: example()
end
mata:
void example()
{
t = "string"
st_local("my_local",t)
stata(`" di "my_local is `my_local'""')
}
end
***end example.ado code***
my_local is displayed as blank instead of "string". However, if I run the three lines of mata code inside of example() interactively, my_local has the contents "string". Why does this work interactively but not in my program? How should this have been coded so that it works?
The same problem happens if I use globals instead of locals.
Julian
*
* 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/