Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: cumulate values of X whithin group


From   sara borelli <[email protected]>
To   [email protected]
Subject   st: cumulate values of X whithin group
Date   Sat, 5 May 2007 20:44:28 +0200 (CEST)

Dear Statalist members,

I have the following question:


Member       Date              X
133          04-05-2000        1
133          04-07-2000        4
133          05-06-2000        2
133          07-10-2000        3

145          06-05-2000        5
145          06-15-2000       5
145          08-05-2000       0
145          10-20-2000       2
145         11-05-2000       4
145          12-03-2000      6

Within each member, I need to create a variable that
cumulates the values of X up to the date of the
current observation excluding the value of X of the
current observation, that is I need to create Xnew
such that:

Member   Date                   X    Xnew
133          04-05-2000        1     0
133          04-07-2000        4     1
133          05-06-2000        2      5
133          07-10-2000        3      7

145          06-05-2000        5      0
145          06-15-2000       5       5  
145          08-05-2000       0       10
145          10-20-2000       2       10
145         11-05-2000       4        12
145          12-03-2000      6        16

any help would be really appreciated
[email protected]



      ___________________________________ 
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: http://it.docs.yahoo.com/nowyoucan.html
*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index