Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: question: mata compilation line skip rules


From   László Sándor <sandorl@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: question: mata compilation line skip rules
Date   Thu, 29 Mar 2012 16:44:03 -0400

Oh, an "end" was missing. Sorry about this. Thanks again.

2012/3/29 László Sándor <sandorl@gmail.com>:
> Thanks, Maarten, this is great.
>
> Would the lines below mean that the source I copied from Ben's
> -moremata- does not compile for me for some reason?
>
> : real colvector _mm_panels(transmorphic vector X, | real scalar np)
>> {
>>         real scalar i, j, r
>>         real colvector res
>>
>>         r = length(X)
>>         if (r<1) return(J(0,1,.))
>>         if (args()<2) np = r
>>         res = J(np, 1, 1)
>>         j = 1
>>         for (i=2; i<=r; i++) {
>>                 if (X[i]==X[i-1]) res[j] = res[j] + 1
>>                 else j++
>>         }
>>         if (j==r) return(res)
>>         return(res[|1 \ j|])
>> }
>
> :
> : *!
> nothing found where subexp expected
> (131 lines skipped)
> -------------------------------------------------------------------------------------------------------------------------------------------------
> r(3000);
>
> What comes after this part of my code (if what crashed is already omitted) is:
>
> *!
> *! mm_callf.mata
> *! version 1.0.1, Ben Jann, 16jun2006
> version 9.2
>
> local o1 "o1"
> local po1 "*p.o1"
> forv i=2/10 {
>        local o`i' "`o`=`i'-1'', o`i'"
>        local po`i' "`po`=`i'-1'', *p.o`i'"
> }
>
>
> On Thu, Mar 29, 2012 at 4:03 PM, Maarten Buis <maartenlbuis@gmail.com> wrote:
>> 2012/3/29 László Sándor :
>>> One of the biggest hints one gets when Mata does not compile is how
>>> many lines were skipped. (I cannot get myself a line number with -set
>>> matalnum- or -set matadebug-.)
>>>
>>> I could not find the documentation on the rules how this is done. How
>>> could I reverse engineer which piece of my code did not compile?
>>>
>>> I have an ado file with multiple Mata function definitions at the end,
>>> also cross-referencing to one another.
>>
>> One way is to open the ado file in the do-file editor and do that .ado
>> file. This in essence treats the .ado file as a .do file that creates
>> a (set of) program(s) and Mata functions. You usually have to first
>> type -clear all- to make sure none of these aren't already in memory.
>> What you are looking for are the first error messages in the Mata
>> section. These are usually a pretty good indicator of where the
>> problem is. The later error messages are usually just the results of
>> the earlier errors and not very informative.
>>
>> Hope this helps,
>> Maarten
>>
>> --------------------------
>> Maarten L. Buis
>> Institut fuer Soziologie
>> Universitaet Tuebingen
>> Wilhelmstrasse 36
>> 72074 Tuebingen
>> Germany
>>
>>
>> http://www.maartenbuis.nl
>> --------------------------
>>
>> *
>> *   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/

*
*   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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index