0

I have a meglm statement with multiple binomial outcomes and I am trying to put it in a foreach loop but whenever I run this code, it gives me the error message "factor-variable operators not allowed":

foreach variable of varlist  burn_post2 {
       meglm `variable1' ib0.Active1_Sham0 || Participant:, family(binomial) link(logit) level(95) eform
}

However if I run this outside the foreach loop, it runs perfectly.

meglm burn_post2  ib0.Active1_Sham0 || Participant:, family(binomial) link(logit) level(95)

What could be going on? Is there anyway to overturn this error message? Thank you!

1 Answers1

1

There is a typo in your code. You wrote `variable1' where it should be `variable'.

foreach variable of varlist  burn_post2 {
       meglm `variable' ib0.Active1_Sham0 || Participant:, family(binomial) link(logit) level(95) eform
}
TheIceBear
  • 2,912
  • 9
  • 23