In a .do file, I generate a double-precision value variable (price x
quantity). I then aggregate, using the collapse command, by ticker
symbol & year. It seems collapse won't allow me to specify data type
but that's probably fine since it chose double for this variable as
well. As a final step, I want to be able to report the value of
trades as a percentage of all trades conducted in a year. Here I use
egen
egen double yrtot = total(rev), by(year)
But instead of values such as 1,045,855,825 I get 1,046,000,000
instead. I looked at help for double & learned that the min & max
values for that data type are enormous. In fact, Stata tells me:
Closest to
Storage 0 without
type Minimum Maximum being 0 bytes
----------------------------------------------------------------------
byte -127 100 +/-1 1
int -32,767 32,740 +/-1 2
long -2,147,483,647 2,147,483,620 +/-1 4
float -1.70141173319*10^38 1.70141173319*10^36 +/-10^-36 4
double -8.9884656743*10^307 8.9884656743*10^307 +/-10^-323 8
So I don't understand why I am getting this rounding. I would
certainly appreciate help.