Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: Formatting fields


From   "Michael Blasnik" <michael.blasnik@verizon.net>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: Formatting fields
Date   Sat, 8 Oct 2005 07:48:08 -0400

You need to make id2 a double when you generate it otherwise you are using a float (by default) which does not contain enough digits of precision.

Michael Blasnik
michael.blasnik@verizon.net

----- Original Message ----- From: <Christopher.Romano@asu.edu>
To: <statalist@hsphsun2.harvard.edu>
Sent: Friday, October 07, 2005 6:47 PM
Subject: st: Formatting fields



Hi!

I have two files one file has ID in the form str10 the other in the form 12.0g.

I want to merge the data by the ID

When I perform a command to change the str var to numeric, the new numeric
field comes in as a float %9.0g

When I reformat that field to 12.0g, the field values change completely.

For instance,

gen id2 =real(id)
<snip>
WHY IS THIS HAPPENING AND HOW CAN I CORRECT IT?

P.S. Using version 6.0

Have a great day!

Chris
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index