| |
[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,
a variable
gen double mysum = r(sum)
Nick
[email protected]
Kyle Hood
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.
Michael Crain
> 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:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/