Statalist The Stata Listserver


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

Re: st: Mata Question


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

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/



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