Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: AW: Diffrence between sum and tabsum


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: Diffrence between sum and tabsum
Date   Tue, 15 Sep 2009 12:54:49 +0200

<> 


Probably a precision issue as in

***

clear*

inp double firstweight
13949.1460454864
13949.146248765 
13949.146324324
end


gen byte dummy=1

su firstweight

tab dummy,  /* 
*/ sum(firstweight)

***



HTH
Martin

-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Ulrich Kohler
Gesendet: Dienstag, 15. September 2009 12:14
An: statalist
Betreff: st: Diffrence between sum and tabsum

<>

Does anybody know why -tabulate, summarize- displays a nonzero
standard-deviation for a variable that is a constant? 

. tab seopsu if seopsu==948, sum(firstweight)

     Cps Pr |
   Sampl Un |       Summary of firstweight
    5:71-73 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
        948 |   13949.146   .00024815           3
------------+------------------------------------
      Total |   13949.146   .00024815           3

. sum firstweight if seopsu==948

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
 firstweight |         3    13949.15           0   13949.15   13949.15

. return list

scalars:
                  r(N) =  3
              r(sum_w) =  3
               r(mean) =  13949.14646024504
                r(Var) =  0
                 r(sd) =  0
                r(min) =  13949.14646024504
                r(max) =  13949.14646024504
                r(sum) =  41847.43938073512

. d firstweight 

              storage  display     value
variable name   type   format      label      variable label
----------------------------------------------------------------------------
------
firstweight     double %10.0g                 

. l firstweight if seopsu==948

      +-----------+
      | firstwe~t |
      |-----------|
4256. | 13949.146 |
4365. | 13949.146 |
4537. | 13949.146 |
      +-----------+

. about

Stata/MP 11.0 for Unix (Linux 64-bit x86-64)
Born 26 Aug 2009
Copyright (C) 1985-2009



*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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