Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

st: RE: Attrition question...

From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: RE: Attrition question...
Date   Sun, 24 Oct 2010 17:37:33 +0100

A solution follows by analogy with an FAQ: 

FAQ     . . . . . . . . . . . . . . . . . .  Dropping spells of missing values
        . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox and G. Longton
        3/07    How can I drop spells of missing values at the
                beginning and end of panel data?

See its section 5 in particular. 

I assume panel identifier -id- and time variable -time- and that the variable -interviewed- is a string variable. 

gsort id -time 
by id : drop if sum(interviewed  == "y") == 0 

Alternatively, assume that -interviewed- is an indicator variable 1 for interviewed and 0 for not. The second line becomes 

. by id: drop if sum(interviewed) == 0

Although your posting does not explain some key features of your dataset, you should be able to modify solutions like this after study of the FAQ.  

On the other hand, I don't understand where the -reshape wide- idea comes from. Datasets like this are best kept long. Also, I don't know what IPTW weights are. 

[email protected]

David Diego Torres, MA(Sociology) PhD Candidate in Sociology

I have a longitudinal file on which I just completed multiple  
imputation.  It has been reshaped to long format.  I need to cycle  
through each case and drop all instances for which someone was missing  
in a round and was never interviewed again up to the most recent  
survey round.  Is there a quick and easy way to do this?

For a case like this:

id     interviewed?     ...      ...

1           y
1           n
1           y
1           y
1           y
1           n
1           n
1           n
1           n

I would like to drop all information from round six on.

The purpose is to drop the fully attrited cases, then reshape wide,  
then back to long.  Then I can calculate IPTW weights.

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index