IceAloe
IceAloe

Reputation: 519

Stata ANOVA: factor variables may not contain noninteger values

I have an outcome variable y and person id id like following:

y            id
-.2900997   19137
.2731551    19143
-.0283341   3.000e+09
.3288157    599
1.045171    2746
.4293538    2746

I am just running a simple command anova y id but get an error message: id: factor variables may not contain noninteger values.

However, the id variable is all integers. The only reason I can think of may be the scientific values such as 3.000e+09. So I change the format using format id %012.0f so they all look like integers now:

y            id
-.2900997   000000019137
.2731551    000000019143
-.0283341   300000000005
.3288157    000000000599
1.045171    000000002746
.4293538    000000002746

However, when I run anova again, the same error occurs.

In addition, oneway y id works without any problem.

Does anyone know how to fix this? Thank you!!

Upvotes: 0

Views: 2649

Answers (1)

Nick Cox
Nick Cox

Reputation: 37208

The limits are documented in help fvvarlist.

Categorical variables to which factor-variable operators are applied must contain nonnegative integers with values in the range 0 to 32,740, inclusive.

Accordingly, try mapping your identifiers to new identifiers 1 up:

egen newid = group(id), label

Upvotes: 2

Related Questions