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

RE: SPAM: st: Re: Cumulative sum


From   "de la Garza, Adrian" <[email protected]>
To   <[email protected]>
Subject   RE: SPAM: st: Re: Cumulative sum
Date   Mon, 3 May 2004 14:56:58 -0400

Michael, 

I don't think that gives me the cumulative sum, does it? It gives me the
overall sum by country. That is, for every observation for which the
country is the same, I will get the same 'sum' variable, if I do it that
way...

> -----Original Message-----
> From: Michael Blasnik [mailto:[email protected]] 
> Sent: Friday, April 30, 2004 5:28 PM
> To: [email protected]
> Subject: SPAM: st: Re: Cumulative sum
> 
> 
> no loop needed...
> 
> by country: gen cum_amount=sum(amount)
> 
> Michael Blasnik
> [email protected]
> 
> ----- Original Message ----- 
> From: "de la Garza, Adrian" <[email protected]>
> To: <[email protected]>
> Sent: Friday, April 30, 2004 4:51 PM
> Subject: st: Cumulative sum
> 
> 
> > 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/
> 
> *
> *   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/
> 

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