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

st: Formatting fields


From   [email protected]
To   [email protected]
Subject   st: Formatting fields
Date   Fri, 07 Oct 2005 15:47:02 -0700 (MST)

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)

. list  id id2 in 1/2

             id        id2 
  1.  402000276   4.02e+08  
  2.  406100271   4.06e+08  

format id2 %12.0g


          id           id2 
  1.  402000276     402000288  
  2.  406100271     406100256  


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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index