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: mata in ado file question: how to have stata lines between the mata code blocks
From
László Sándor <[email protected]>
To
[email protected]
Subject
st: mata in ado file question: how to have stata lines between the mata code blocks
Date
Sat, 31 Mar 2012 16:41:23 -0400
Hi all,
I think I am following the existing and the "missing" manual on Stata
(i.e. Bill's UKSUG10 slides), but I might have zeroed in on why my
code does not run (on Stata 12.1 MP for mac).
Basically, I wanted to define several mata functions and as I cannot
simply upload existing libraries to my server, I thought I would also
paste in the source code for -moremata- functions my Mata code used.
The code compiled now, but gives me the rare and poorly documented
error r(9611). Some Googling taught me this is about a loop going
wrong. Now I have an idea where, but perhaps it's better for all to
ask you what the code should look like in the first place.
Currently it has blocks like
program define…
…
end
mata:
…
end
mata:
…
end
local o1 "o1"
local po1 "*p.o1"
di "loop of locals"
forv i=2/10 {
local o`i' "`o`=`i'-1'', o`i'"
local po`i' "`po`=`i'-1'', *p.o`i'"
}
mata:
…
end
Maybe the Stata loop that one of the Mata definitions uses is just
hanging there (outside of all blocks that end with and "end"). Where
should I place it? Is it OK to have all these "mata: … end" blocks in
the first place?
Sorry it was not clear to me from the manuals.
Thanks!
Laszlo
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/