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

Re: st: A strange data problem


From   Ted Anagnoson <[email protected]>
To   [email protected]
Subject   Re: st: A strange data problem
Date   Sat, 15 Jan 2005 22:42:06 -0800

Hi Maoyong,

It is probably the storage type - you have very large numbers (3.76e+10), the variable stored as float has only 8 sig digits (I think) while the double has twice that. I could see that resulting in a difference on these large numbers of 145 or so....

Check the manual for storage types - I think that is where I would start

Ted Anagnoson
Political Science
Cal State LA



At 10:15 PM 1/15/05 -0800, you wrote:

Dear Stata User,

I met a strange problem in dealing with my scanner data. I use stata transfer to transger the original data to dta files. One of my variables is UPC whose storage type is double. I found that when I generate a new variable equal to UPC, the new variable is totally different from UPC.

Like this:
gen UPC1 = UPC
gen diff = UPC1 - UPC
sum
des

Variable | Obs Mean Std. Dev. Min Max
-------------+--------------------------------------------------------
UPC | 1780770 3.76e+10 1.96e+11 1.00e+10 2.72e+12
UPC1 | 1780770 3.76e+10 1.96e+11 1.00e+10 2.72e+12
diff | 1780770 144.9445 4290.722 -105114 116086

. des

Contains data from D:\temp\dairyHH1.dta
obs: 1,780,770
vars: 3 18 Jun 2003 13:27
size: 35,615,400 (66.0% of memory free)
-------------------------------------------------------------------------------
storage display value
variable name type format label variable label
-------------------------------------------------------------------------------
UPC double %15.0g UPC -
system/generation/vendor/item
UPC1 float %9.0g
diff float %9.0g
-------------------------------------------------------------------------------
Sorted by:
Note: dataset has changed since last saved

Anyone know what's wrong with this?

Warm regards,

Maoyong Fan



*
* 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/
*
*   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