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: age: factor variables may not contain noninteger values

From   Maarten Buis <>
Subject   Re: st: age: factor variables may not contain noninteger values
Date   Tue, 8 Nov 2011 11:40:25 +0100

On Tue, Nov 8, 2011 at 11:13 AM, Lars Folkestad wrote:
> I am trying to investigate the interactions between age and a grouping variable in a regression model, using this code:
> xi: regress Var1
> Var1: is a continuous variable
> Age: is a continous variable / float
> When i run the code i get the following error message:
> age:  factor variables may not contain noninteger values

First, you are mixing -xi- and factor variable notation. You should
just leave the -xi:- prefix away.

Second, in most surveys I am aware of age will be measured in whole
years. In those cases age should only contain integer values and this
error message means I made an error while preparing the data. This is
true regardless of how the data is stored. However, this is not
necessarily an error, you could have fractional age if you had for
instance exact birth dates and exact dates at which events of interest
happen. Alternatively, I may have standardized age or rescaled it so
it is measured in decades rather than years. However, in the latter
two cases I would have created new with different variable names
(probably z_age and age_d). So I would check whether non-integer age
would make sense given the way your data was collected.

Third, whether there is an error or not you probably want -regress
var1 i.e. tread age as a continuous variable and not
as a set of dummies.

Hope this helps,

Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen

*   For searches and help try:

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