Statalist The Stata Listserver

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

Re: st: Mata Question

From (William Gould, Stata)
Subject   Re: st: Mata Question
Date   Wed, 15 Nov 2006 14:57:37 -0600

Danielle Ferry <> 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
*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index