Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: tsset - repeated time values within panel
From
emanuele mazzini <[email protected]>
To
[email protected]
Subject
Re: st: tsset - repeated time values within panel
Date
Wed, 30 Mar 2011 12:18:38 +0200
Sorry for the wrong sending. I know what you mean, but I need to
replace missing values. I can be
more precise with the following example:
group year pairid
1 2002 .
1 2003 2
1 2004 2
2 2002 .
2 2003 3
2 2004 3
and I need to replace the missing values for pairid, which are
obviously the same for the previous years for which data are missing.
Hope this helps,
Thank you.
>
> 2011/3/30 Nick Cox <[email protected]>:
>> 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
>> <[email protected]> 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 <[email protected]>:
>>>> 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
>>>> <[email protected]> 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 <[email protected]>:
>>>>
>>>>>> 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
>>>>>> <[email protected]> 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/
>>
>
*
* 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/