[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: Mata Question
Danielle Ferry <DFerry@bear.com> 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.
* For searches and help try: