Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

st: generating cumulative sequence


From   "Ivica Rubil" <irubil@eizg.hr>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: generating cumulative sequence
Date   Wed, 21 Mar 2012 09:46:48 +0100

Dear Stata users,

How can I generate Var2 (see below), i.e. the cumulative sequence based
on Var1? It seems an egen function can do the job, but which one? Or
there's another solution? Thanks in advance.

Var1               Var2
-----------------------
1                    1
5      1+5 =         6
6      1+5+6 =      12
8      1+5+6+8 =    20  
12     1+5+6+8+12 = 32



--
Ivica Rubil
Ekonomski institut || The Institute of Economics, Zagreb
Trg J. F. Kennedyja 7, 10 000 Zagreb, Croatia
tel. +385-1-2362-269 || fax. +385-1-2335-165
irubil@eizg.hr || www.eizg.hr


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