Statalist


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

Re: st: How to generate a cumulative sum


From   "Austin Nichols" <austinnichols@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: How to generate a cumulative sum
Date   Fri, 26 Oct 2007 09:59:51 -0400

Like so:

loc d 0.05
webuse grunfeld, clear
g k0=int(uniform()*1000) if year==1935
g k=.
bys c (y): replace k=cond(l.k<.,l.k*(1-`d'),k0)+i
li com year k0 k inv in 1/10, noo sepby(com)

On 10/26/07, Scott Merryman <scott.merryman@gmail.com> wrote:
> There needs to be a space between c and (y) and d has not been defined.
*
*   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