[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: Loosing precision with Total( )
Losing [not loosing] precision is not the only issue here.
If all you want is the sum, there is no need to use -egen, total()-,
nor to put the result in a variable.
. su myvar, meanonly
leaves behind the sum in r(sum).
You can display it to your favourite format
display %28.10f r(sum)
or put the result anywhere you want, including, if need be,
gen double mysum = r(sum)
You can always specify the datatype when using egen, for example,
egen double z = total(x)
I'm not sure where you are using total().
Are you sure the "loss of precision" to which you are referring is
actually that? It may simply have to do with the display format.
> The solution to this issue is probably simple. Here is my problem.
> I am using theTotal function to calculate the total of a variable for
> a large number of observations: total(var)
> I get a result of something like 7.25e+08
> How do I get the total without loosing precision?
> Stata version 9
* For searches and help try: