Statalist


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

st:re:re: if-sentences in Stata


From   Kit Baum <[email protected]>
To   [email protected]
Subject   st:re:re: if-sentences in Stata
Date   Fri, 28 Nov 2008 10:54:32 -0500

<>
Linn said

1) When you type L.flow is that referring to the
Value in cell [_n-1]?

2) you type flow = (shift == - 1)*..... and then + (shift == 1)*...
Adding the + there and then (shift == 1) means Stata should
execute the last command only if the (shift == 1) is true?

The 2/1 at last means starting in cell 2 and continue in
Steps of 1, right? As you probably understand I am
Kind of new to programming syntax in Stata.



(1) yes.

(2) I diagrammed the logic of your original program, which did different things depending on whether shift was -1 or +1, and then depending on the subsidiary expression involving last period's flow. The construct

(foo == 1) * ( AAA) + (foo = 2) * (BBB) will either execute the AAA code or the BBB code, presuming that every observation has foo equal to either 1 or 2.

(3) Yes, the numlist 2/l (that is 2/L) means from observation 2 to the Last. You must start at 2 to avoid L.flow being missing in period 1, which would propagate missings through the sequence.


Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html


*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index