Statalist


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

Re: st: Data Management


From   "Raphael Fraser" <[email protected]>
To   [email protected]
Subject   Re: st: Data Management
Date   Tue, 18 Nov 2008 16:54:43 -0500

I spent the day at a SAS workshop. Imagine that!! I only just seeing
the threads.

What makes this problem a bit tricky is the order of the sequences of
zero must be preserved.

So Nick is on the ball. I'll now go see what tsspell has to offer.

Thanks!!
Raphael


On Tue, Nov 18, 2008 at 6:17 AM, Nick Cox <[email protected]> wrote:
> No; this throws away information on sequences, as indicated by the way
> "consecutive".
>
> Nick
> [email protected]
>
> Alexander Staus
>
> If I understand you right, e.g
>
> by id count, sort: gen N=_N
> drop if count==0 & N>=3
>
> would help.
>
> Raphael Fraser schrieb:
>
>> I have longitudinal data with "id" as unique identifier, "timevar" as
>> the time variable and an outcome variable I call "count." The timevar
>> contains the elapsed time in minutes. I would like to exclude all
>> zeros where there are 3 or more consecutive zeros for each person. Can
>> anyone help?
>>
>> id  timevar count
>> 1    1         56
>> 1    2         2
>> 1    3         0
>> 1    4         0
>> 1    5         0
>> 1    6         0
>> 1    7         5
>> 1    8         0
>> 1    9         0
>> 2    1         230
>> 2    2         0
>> 2    3         0
>> 2    4        19
>
> *
> *   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index