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]
st: Re: spells of missing values completely in between
From
Abhimanyu Arora <[email protected]>
To
[email protected]
Subject
st: Re: spells of missing values completely in between
Date
Sat, 7 Apr 2012 13:01:05 +0200
Somehow I feel the step in which the temp is generated can be omitted
by a clever use of the -cond- option.
On Sat, Apr 7, 2012 at 12:57 PM, Abhimanyu Arora
<[email protected]> wrote:
> Dear statalist
> I was wondering if there is a more elegant solution to one below
> involving SSC's tsspell by Nick Cox
> . which tsspell
> c:\ado\plus\t\tsspell.ado
> *! 2.0.0 NJC 13 August 2002
>
> The aim is to create an indicator for spells of missing values
> completely in between a series (excluding those at the beginning or
> the end). (A part in the process of intrapolating a time series,
> basically)
>
> I used the following set of commands.
>
>
> clear
> set obs 12
> gen var1=_n
> tsset var1
> input var2
> .
> .
> .
> 56
> .
> .
> .
> 95
> .
> 20
> .
> end
> tsspell var2
> egen temp=max( _spell)
> gen ind=(var2==. & _spell==1)|(var2==. & temp==_spell)| (var2!=.)
>
> Cheers
> Abhimanyu
*
* 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/