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: float to numeric??
From
"Michael N. Mitchell" <[email protected]>
To
[email protected]
Subject
Re: st: float to numeric??
Date
Sun, 20 Jun 2010 20:23:15 -0700
Greetings Özlen
I think the issues that you are encountering relate to what I covered in the Stata
Tidbit of the Week this week at
http://www.michaelnormanmitchell.com/stow/floats-and-doubles.html
I would suggest trying this...
generate double chipeligrated = round(chipeligrate,0.01)
This will create a double precision variable called -chipeligrated- (ending in -d- to
signify that it is double precision), but you can call it anything you like. I bet that
this will solve your "major troubles".
Let us know how this goes.
I hope this helps,
Michael N. Mitchell
Data Management Using Stata - http://www.stata.com/bookstore/dmus.html
A Visual Guide to Stata Graphics - http://www.stata.com/bookstore/vgsg.html
Stata tidbit of the week - http://www.MichaelNormanMitchell.com
On 2010-06-20 7.42 PM, Özlen D. Luznar wrote:
Hi everyone,
I have a variable stored as float chip eligibility rate variable. very
straightforward - varies between .1 and 4. But it is stored as float and
gives me major toruble when I am using the values to generate new
variables etc. I would like to store it as numeric so that stata can
recognize the values of this variable. Does anyone have experience with
this??
. codebook chipeligrate
------------------------------------------------------------------------------
chipeligrate chip eligibility rate by year and age and
state
------------------------------------------------------------------------------
type: numeric (float)
range: [.1,4] units: .01
unique values: 40 missing .: 0/6585
mean: 1.92923
std. dev: .720279
percentiles: 10% 25% 50% 75% 90%
1 1.5 2 2 3
I need to chnage this variable and store is as int but I can not figure
out how. So far I tried compress but it seemed to work but when I
described the variable, still float.
Thanks so much for your help in advance.
*
* 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/