Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

Re: st: using varlist wildcards in anova

From   Phil Schumm <>
Subject   Re: st: using varlist wildcards in anova
Date   Sat, 3 Apr 2010 21:46:56 -0500

On Apr 3, 2010, at 6:25 PM, Phil Schumm wrote:
On Apr 3, 2010, at 5:45 PM, Vineet Bhagwat wrote:
Which is weird, because on my computer's Stata, "reg y t* " and any other command using the asterisk works fine, just -anova- that seems to throw the error for some reason. I'm using Stata9 on my computer if that clarifies anything.

Well, at least that narrows it down. I no longer have a version of Stata 9 on my machine, so I can't look at this issue further. Perhaps someone with Stata 9 still available (or a better memory of - anova- under version 9) might be able to add something.

One workaround would be the following (IIRC, -unab- predated Stata 9):

   unab t: t*
   anova y `t'

though upgrading, if possible, would clearly be preferable.

Ok, I must confess that this made me a bit curious, especially since my previous statement

On Apr 3, 2010, at 5:21 PM, Phil Schumm wrote:
Regardless, this isn't due to -anova-, but rather is a function of how Stata is parsing the command line.

was clearly incorrect (I also misspoke when I said "parsing the command line" -- what I should have said was "expanding the varlist"). Instead, this *does* have to do with -anova-'s syntax. I pulled an old copy of Stata 9, and sure enough, I get exactly the behavior Vineet describes.

Unfortunately, in Stata 9 -anova- was a built-in command, so we can't look at the source. However, the syntax diagram

    anova varname [term [/] [term [/] ...]] [if] [in] [weight] [,

    where term is of the form   varname[{*||}varname[...]]

suggests that -anova- was using its own approach to interpret the list of model terms, and although one could specify a model as a simple list of variables, -anova- under Stata 9 evidently didn't support varname globbing.

In sum, the workaround I gave above is your only option under Stata 9.

-- Phil

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index