Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: RE: running sum


From   Maximiliano Manuel Silva Correa <[email protected]>
To   [email protected]
Subject   Re: st: RE: running sum
Date   Wed, 4 Aug 2010 11:14:48 -0400

That works perfect!!! Thank you Nick

2010/8/4 Nick Cox <[email protected]>:
> bysort line (subst) : gen cum_power = sum(power)
>
> Nick
> [email protected]
>
> Maximiliano Manuel Silva Correa
>
> Im stuck trying to do a running sum using by.  My problem is like:
>
> Suppose we have serveral power distribution lines (composed of
> serveral substations) all around the states. Suppose our variables are
> LINE SUBST POWER
>
> I want to generate a variable CUM_POW containing the cummulative sum
> of POWER  by LINE SUBST
>
> For instance,
>
> LINE SUBST POWER CUM_POW
> 1          1          10             10
> 1          2          20             30
> 1          3          15             45
> 1          4           5              50
>
> how goes the sintaxis for that?
>
> *
> *   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index