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 on April 23, and its replacement, statalist.org is already up and running.


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

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


From   William Buchanan <william@williambuchanan.net>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
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 <sams.james@gmail.com> 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
> sams.james@gmail.com
> *
> *   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index