Bookmark and Share

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]

Re: st: Too many macros, but I create 1!


From   William Buchanan <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Too many macros, but I create 1!
Date   Wed, 5 Dec 2012 16:46:53 -0800

Have you tried running your program with -set trace on-? It might provide some more useful information to you about where things are going wrong.

HTH,
Billy

Sent from my iPhone

On Dec 5, 2012, at 16:28, James Sams <[email protected]> wrote:

> I have a program that drops into mata, generates a row vector, converts it to 
> strings and then sends to stata as a macro. The macro it generates is about 
> 400,000 characters long, with about 62,000 individual entries, well within the 
> limits of stata-12 mp 8 core edition. Here is some test code that shows what 
> is going on and mimics the attributes of my data.
> 
> program test_case, rclass
>    mata {
>        indexes = 50000
>        for (i=1; i<=61611; i++) {
>            indexes = indexes, i+indexes[1]
>        }
>        cols(indexes)
>        indexes = strofreal(indexes)
>        indexes = invtokens(indexes)
>        strlen(indexes)
>        st_local("indexes", indexes)
>    }
>    return local indexes `indexes'
> end
> 
> And when I run it:
> 
> 
> . test_case
>  61612
>  381283
> too many macros
> r(920);
> 
> I'm certainly not generating too many macros. Either st_local or return is, as 
> far as I can tell. Thoughts on what I should be doing?
> 
> -- 
> James Sams
> [email protected]
> *
> *   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/

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


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index