Statalist


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

st: sum: collapse vs egen


From   [email protected]
To   [email protected]
Subject   st: sum: collapse vs egen
Date   Sat, 05 Sep 2009 14:15:08 +0200

Hello,
   Here is my code:

clear
version 9.2
set obs 1
gen double a=3.86
save data1,replace

clear
set obs 1
gen double a=4.895
save data2,replace

use data1,clear
append using data2
egen sum=sum(a)
gen double r1=round(sum*100)/100
list
collapse (sum) a
gen double r2=round(a*100)/100
list

Why are r1 and r2 not equal ?

Thank you,
Carlo

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


*
*   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