Statalist


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

st: rowtotal & adding columns


From   Nico <nico1637@yahoo.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: rowtotal & adding columns
Date   Wed, 17 Jun 2009 07:07:04 -0700 (PDT)

I am trying to create new columns that are the sum of existing columns, but the resulting numbers are not what is expected.  As an example, I manually entered the following var1 var2 var3(no decimals); then used egen tot=rowtotal(var*); then used gen add=var1+var2+var3.
The resulting tot and add are okay for smaller numbers, but not for the larger numbers.  The last two rows should be 370,370,367 and 964,964,961 respectively.  Am I doing something incorrectly?  I can't seem to figure it out...  

Thanks,
Ryan


 
var1	  var2	    var3	      tot 	add
1	  5	    9	      15	         15
2	  6	    10	      18	         18
3	  7	    11	      21	         21
4	  8	    12	      24	         24
123456789	  123456789  123456789  370370368	370370368
321654987  321654987  321654987  964964928	964964992


      

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index