Statalist The Stata Listserver


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

Re: st: Mata Question


From   wgould@stata.com (William Gould, Stata)
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Mata Question
Date   Wed, 15 Nov 2006 14:57:37 -0600

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.


-- Bill
wgould@stata.com
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index