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: Missing Values
From
Nick Cox <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: Missing Values
Date
Wed, 8 Jan 2014 10:19:16 +0000
<>
If that really is the error message, you are typing
seq
where you mean
_seq
i.e. you are not typing the command you need.
Nick
[email protected]
On 8 January 2014 03:16, Sadia Khalid <[email protected]> wrote:
> Thanks a lot for the reply
>
> I am getting an error for this command
>
> egen max = max(_seq), by(company _spell)
>
> The error message is "seq not found"
>
> Please look at this issue.
On 7 January 2014 23:22, Nick Cox <[email protected]> wrote:
>> That's not what you said, but it makes more sense. Here is some technique:
>>
>> First, you show no data, so we need a sandpit to play in:
>>
>> webuse grunfeld, clear
>> set seed 2803
>> replace invest = . if runiform() < 0.7
>>
>> Download -tsspell- from SSC and then identify spells of missing values:
>>
>> tsspell , c(missing(invest))
>>
>> The length of each spell is an easy calculation
>>
>> egen max = max(_seq), by(company _spell)
>>
>> Then any interpolation is made conditional:
>>
>> by company: ipolate invest year if max <= 5, gen(invest2)
>>
>> For explanation of the _principles_ of identifying spells, see
>>
>> SJ-7-2 dm0029 . . . . . . . . . . . . . . Speaking Stata: Identifying spells
>> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox
>> Q2/07 SJ 7(2):249--265 (no commands)
>> shows how to handle spells with complete control over
>> spell specification
>>
>> http://www.stata-journal.com/sjpdf.html?articlenum=dm0029
On 7 January 2014 17:37, Sadia Khalid <[email protected]> wrote:
>>> I only want to fill in the missing values if the no of missing values
>>> are equal to or less than 5. if 5 or more values are missing than do
>>> not fill in the missing values.
On 7 January 2014 22:31, Nick Cox <[email protected]> wrote:
>>>> So 5 is OK for interpolation, but 4 or 6 isn't? Sounds bizarre.
On 7 January 2014 17:22, Sadia Khalid <[email protected]> wrote:
>>>>> I have read about your code for filling the in between missing values
>>>>> at http://www.stata.com/statalist/archive/2003-05/msg00247.html
>>>>>
>>>>> I want the code that fill the missing values only if 5 inbetween
>>>>> values are missing.
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/