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]

st: Understanding the mechanics of the sum() function


From   Billy Schwartz <[email protected]>
To   [email protected]
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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index