Danielle Ferry <[email protected]> wrote,
> I'm hoping someone can help me with this. I know how to do it in Stata,
> but not Mata.
>
> Suppose in my pure time series dataset I have a variable, Y, and want to
> create a new variable, Z, where Z = . if t=1, Z = Y if t = 2, and Z =
> Z[_n-1] if t>2. After I create a data view, this is simple to implement
> in Mata (assuming my data is already sorted):
>
> [...]
> Suppose, now, that I have a panel. I want the same definition for Z to
> apply WITHIN EACH PANEL. It is clearly this part that needs to be
> amended somehow, but I'm not sure how to do it best:
See -help mata panelsetup()-. I think it will solve your problem.
-- Bill
[email protected]
*
* 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/