Statalist


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

st: RE: Errors in egen, total()


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Errors in egen, total()
Date   Sun, 13 Dec 2009 09:35:59 +0100

<>

You have to tell Stata to make the new variable "double"

*******
bys title week: egen double cumrev=total(rev)
*******

See http://www.stata.com/help.cgi?datatypes


HTH
Martin

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Mike Kim
Sent: Sonntag, 13. Dezember 2009 05:20
To: statalist@hsphsun2.harvard.edu
Subject: st: Errors in egen, total()

Hello all,

I used "egen total()" to create "cumrev" like the following, but if there is

only one week per title, total gives a slightly lower number than the 
original number in some cases (1 or 2 lower). Any idea about why it produces

different numbers?

bys title week: egen cumrev=total(rev)

title   week    rev                 cumrev
A       707     28536717     28536716
A       708     10                   30
A       708     20                   30
B        801    .....
......

Thank you,
Mike. 

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