Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Does mkmat have a variable limit?

    Hi Stata users,

    I'm trying to run a meta-analysis regression (i.e. "meta-regression") using the user-written command robumeta. At one point in the program it uses mkmat to form its selection matrix. It seems that it is running into a limit to the number of variables it will accept, or maybe there is a limit to the length of a macro. I have never run into a problem like this. The robumeta command works fine when I use less variables. Do you know what could cause this sort of problem?

    Here is the output from "set trace on":

    - matrix colnames `T' = `t'
    = matrix colnames __000015 = effectsize
    - mkmat `x' `cons' if `touse' & `studynumber' == `j', matrix(`X')
    = mkmat rigor1 rigor2 rigor3 rigor4 researcherdeveloper _Itopic_2 _Itopic_3 _Itopic_4 _Itopic_5 _Itopic_6 _Itopic_7 _Itopic_8 _Itopic_9 _Itopic_10 _Itopic_1
    > 1 _Itopic_12 _Itopic_13 _Itopic_14 _Itopic_15 _Itopic_16 _Itopic_17 _Itopic_18 _Itopic_19 _Itopic_20 _Itopic_21 _Itopic_22 _Itopic_23 _Itopic_24 _Itopic_25 _Ito
    > pic_26 7 0 __000002 if __000000 & __00000D == 1, matrix(__000020)
    ------------------------------------------------------------------------------------------------------------------------------------------ begin mkmat ---
    - version 9, missing
    - syntax varlist(numeric) [if] [in] [, MATrix(name) noMISsing ROWNames(varname) ROWEq(varname) ROWPREfix(string) OBS NCHar(numlist integer max=1 >=1 <=32)
    > ]
    7 invalid name

    The macro `x' is set early using standard commands:
    *create macros of variables
    tokenize `varlist'
    local t `1'
    macro shift
    local x `*'

  • #2
    Well, I believe that the "7" that Stata is objecting to here is this one:
    Code:
    pic_26 7 0 __000002 if __000000 & __00000D == 1, matrix(__000020)
    I can't tell if it is tacked on to the end of `x' or the beginning of `cons', but one of those macros is putting it there. So I suggest you -display- both macros to see which one is the problem, and then go back to the code that generated it.

    What you show for the creation of macro x, looks like it would not be the source of the problem, so I would check `cons' first. But if the -varlist- that is being -tokenize-d is not actually created by a -syntax- command, then it could somehow have gotten contaminated with a 7. And it is also possible that someplace else in your code there is something that appends a 7 to the end of local macro x.

    Comment


    • #3
      Thanks, Clyde. I'll go over the code again and see what I've missed. You're the best!

      Comment

      Working...
      X