Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Cumulative sum


From   "de la Garza, Adrian" <ADelagarza@imf.org>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Cumulative sum
Date   Fri, 30 Apr 2004 16:51:07 -0400

Hello everyone.

I would like to create a variable that gives me the cumulative of an
amount by country, like so:

country	year	quar	amount	cum_amount
Argentina	1990	1	100		100
Argentina	1990	2	50		150
Argentina	1990	2	25		175
Argentina	1990	2	100		275
Argentina	1990	3	200		475
...
Bolivia	1990	1	25		25
Bolivia	1990	1	30		55
...

Does anyone know a command that would do this without needing to write a
loop?

Thank you!
Adrian

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