Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: Filling in gaps in time variable


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Filling in gaps in time variable
Date   Mon, 9 Feb 2009 12:21:12 -0000

The key question is: What to you defines a panel, bearing in mind that
Stata's definition of panel allows at most one observation for each
combination of panel identifier and time? 

My guess from this is that your panels are perhaps the distinct
combinations of -country- and -title-, in which case Stata might be
satisfied by 

egen id = group(country title) 
tsset id week 

but only you can say whether that matches the data generating process
you have in mind. 

Nick 
[email protected] 

Mike Kim

I have a question about tsfill. My data look like this:

week  rev  title country
1      992   A     P
2      182   A     P
4      221   A     P
1      258   A     Q
2      278   A     Q
3      293   A     Q
5      336   A     Q
7      342   A     Q

I tried "tsset  title week" to use tsfill, but Stata says "repeated time

values within panel". "tsset  country week" gives the same error message

because week is repeated within a country, too. I want to fill missing
weeks 
like the following. Is there any way to do this?

week  rev  title country
1      992   A     P
2      182   A     P
3      221   A     P
4      221   A     P
1      258   A     Q
2      278   A     Q
3      293   A     Q
4      336   A     Q
5      336   A     Q
6      342   A     Q
7      342   A     Q


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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