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, is already up and running.

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

Re: st: too many macros

From   Keith Dear <>
Subject   Re: st: too many macros
Date   Thu, 30 Jun 2011 12:52:03 +1000

Is your program really called "prog"? That's not wise - you can define
it, but how do you call it?
Try a name that is not a reserved word (e.g. "myprog").

That aside, I can't elicit that error message: your code works for me,
even with 1000 rhs variables.
Which version do you have? In Stata11, -help limits- does not mention
any such limit, even for Small Stata.

On 30 June 2011 12:01, ali hashemi <> wrote:
> Dear list members,
> Is there any limit on the number of macros that can be defined in a program?
> I am using local macros to read the regressors in the varlist. Here is the
> syntax:
> program prog
> syntax varlist
> local N: word count `varlist'
> gettoken lhs rhs: varlist
> forval i=1/`N' {
>        local x`i' : word `i' of `rhs'
>        }
> ...
> end
> The above code works fine when the number of variables in the varlist is
> less than 18. However, in my case I have at least 400 variables in the
> varlist and I get this error message: "too many macros"
> Is there anything wrong with the above code that causes this problem? If
> there is a limit for the number of macros defined in the program how can I
> call the regressors in the varlist?
> Your help is very much appreciated
> Best,
> Ali
> *
> *   For searches and help try:
> *
> *
> *

Dr Keith Dear
National Centre for Epidemiology and Population Health
ANU College of Medicine, Biology and Environment
Australian National University
Canberra, ACT 0200 Australia
Phone +61 (02) 6273 2208

*   For searches and help try:

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