Hi All,
I am writing an ado. file that performs a task following a linear multilevel model (either mixed or meglm with family(gaussian)).
As such, I have an error message that evaluates whether the prior estimation model was either of these cases:
Well, this error message doesn't work because it will get tripped up on either the first part ("`e(cmd)'" != "mixed") when using meglm or the second part, when using mixed
I also tried nesting the "if" statement using the two parts, but that didn't work either...
Any help would be appreciated!
Thanks!
Ariel
I am writing an ado. file that performs a task following a linear multilevel model (either mixed or meglm with family(gaussian)).
As such, I have an error message that evaluates whether the prior estimation model was either of these cases:
Code:
webuse productivity // using mixed mixed gsp private emp hwy water other unemp || region: || state: // using meglm meglm gsp private emp hwy water other unemp || region: || state:
Code:
if ("`e(cmd)'" != "mixed") | ("`e(cmd2)'" != "meglm" & "`e(model)'" != "linear") { di as err "the prior estimation model was not {bf:mixed} or {bf:meglm} with a linear model" exit 301 }
Code:
when using mixed, the second part produces the error because there is no "`e(cmd2)'": if ("mixed" != "mixed") | ("" != "meglm" & "" != "linear")
Code:
when using meglm, the first part produces the error because e(cmd) == gsem (and I purposely am not allowing gsem at this stage of development) if ("gsem" != "mixed") | ("meglm" != "meglm" & "linear" != "linear")
Any help would be appreciated!
Thanks!
Ariel
Comment