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 on April 23, and its replacement, statalist.org is already up and running.


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

st: Understanding the mechanics of the sum() function


From   Billy Schwartz <wkschwartz@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Understanding the mechanics of the sum() function
Date   Sun, 13 Nov 2011 17:14:08 -0500

Is there a difference between

. generate y = `a' + `b' * sum(`exp')

and

. generate y = .
. replace y = `a' + `b' * (`exp' + cond(missing(y[_n-1]), 0, y[_n-1]))

where `a', `b', and `exp' are arbitrary Stata expressions? If they're
not the same, is there a way of modifying the second to make it the
same as the first? (If they're the same in effect, is one faster than
the other?)
*
*   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