Bookmark and Share

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


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

RE: st: age: factor variables may not contain noninteger values


From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   RE: st: age: factor variables may not contain noninteger values
Date   Wed, 9 Nov 2011 13:03:53 +0000

I think that we are all partly joking now, but this doesn't convince. [40, 41) is just as much an interval as [39.5, 40.5). 

Nick 
[email protected] 

Jesper Lindhardsen

I agree with both of you. However, since Lars wanted to use age as a categorical variable , this implies reducing the age information to an interval. In this sense, round will provide the -.5 to +.5 interval..... which makes Lars 40 already ;-)

Nick Cox

All that said, as age as an integer usually means "age last birthday",
I am surprised that -round()- is regarded as the answer. I would put
my foot down for -floor()-.

For example, I am 19 and will not be 20 until next birthday.

Nick

On Tue, Nov 8, 2011 at 7:29 PM, Lars Folkestad <[email protected]> wrote:
> Thank you for that jesper. It sure did the trick.
> lars
>
> Den 08/11/11 13.17 skrev "Jesper Lindhardsen" <[email protected]>:
>
>>Hi Lars,
>>
>>Try
>>
>>
>>g new_age= round(age_var,1)
>>
>>
>>HTH,
>>
>>Jesper
>>
>>-----Original Message-----
>>From: [email protected]
>>[mailto:[email protected]] On Behalf Of Lars
>>Folkestad
>>Sent: 08 November 2011 12:14
>>To: [email protected]
>>Subject: Re: st: age: factor variables may not contain noninteger values
>>
>>This helps a lot.
>>Thank you.
>>
>>But i have a question about the second point.
>>Is there a quick and easy way to round the age to the nearest integer
>>value? I could use the floor / ceil functions, but some of the ages
>>Should be rounded up and some should be rounded down.
>>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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