Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Nick Cox <njcoxstata@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: tsset - repeated time values within panel |
Date | Wed, 30 Mar 2011 10:47:41 +0100 |
There is a difference between filling in gaps and replacing missing values. Evidently you have gaps but no missing values. If my data run group year 1 2007 1 2008 1 2009 2 2007 2 2009 I have a gap for group 2 and year 2008. That is not a missing value. You can use -tsfill- to fill in gaps but it won't add any information to your data. Conversely this is an example of a missing value group year Stata_users 2 2007 4000000 2 2008 . 2 2009 5000000 Nick On Wed, Mar 30, 2011 at 10:38 AM, emanuele mazzini <madsoenistata@gmail.com> wrote: > Right. This is what I get with the command that you suggested me: > > egen group = group(iso1 iso2), label > > . tsset group year > panel variable: group (unbalanced) > time variable: year, 1950 to 2006, but with gaps > delta: 1 unit > > but when I say it does not work I mean that basically stata does not > make any change in the dataset. > > > 2011/3/30 Nick Cox <njcoxstata@gmail.com>: >> I don't know what you mean by "does not work". That command should >> work if your data have been properly -tsset-. Show us the result of >> typing >> >> . tsset >> >> Nick >> >> On Wed, Mar 30, 2011 at 10:22 AM, emanuele mazzini >> <madsoenistata@gmail.com> wrote: >>> Hi Nick. >>> Thank you very much for your suggestion. The command you gave me did >>> work, but how can I replace now missing values for some given years >>> for which I have data for the previous/following years? I tried the >>> command: replace myvar = L.myvar if myvar >=. but it does not work. >>> >>> Thank you very much in advance, >>> Emanuele. >>> >>> 2011/3/29 Nick Cox <njcoxstata@gmail.com>: >> >>>> You don't say how you are defining panels with -tsset-. It sounds as >>>> if you regard a country pair as defining a panel, in which case >>>> something like >>>> >>>> . egen group = group(cty1 cty2), label >>>> . tsset group year >>>> >>>> is the way to proceed. >>>> >>>> On Mon, Mar 28, 2011 at 11:00 PM, emanuele mazzini >>>> <madsoenistata@gmail.com> wrote: >>>> >>>>> I have a panel bilateral dataset with country pairs from year 1950 to >>>>> 2006 and experiencing the error message repeated time values within >>>>> panel when typing tsset. I have already read some messages sen by >>>>> other people experiencing the same issue, and also I tried to follow >>>>> the suggestion of the guide, but still cannot understand why i got >>>>> that. >>>>> To be more precise, as mine is a bilateral dataset, I have to say that >>>>> every observation is identified by three variables (cty1, cty2 and >>>>> year) so may be the problem relates to this, but obviously I am not >>>>> sure. >>>>> Finally, I am not really interested in the command per se, but the >>>>> point is to replace some missing values which are time-constant and >>>>> for which I do have data for the previous/following years. >>>>> Can anybody help me to deal with this? * * 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/