Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

Re: st: Tracking attrition in a long-shaped dataset

From   Nick Cox <>
Subject   Re: st: Tracking attrition in a long-shaped dataset
Date   Thu, 21 Mar 2013 14:44:32 +0000

What your -month- variable is holding is unclear to me.

In terms of your questions

#1. It is evident that

month == month[_n+1] - 1

is true if and only -month- increases by 1 from one observation to the next.

It's difficult to check that against your word description. Usually
with panel data, there is a time variable and then all the business is
centred on what is or is not true at different times. Here you seem to
be focussing entirely on the time variable.

#2. Understanding this depends on understanding #1, and evidently failed.

If you don't get a better answer, you will need to ask a better question.


On Thu, Mar 21, 2013 at 2:19 PM, Max <> wrote:

> I have a long dataset of ID's (people) and months. People enter and leave
> the dataset at various points, and can skip months. I want to track
> attrition by doing two things:
> 1. Create a dummy variable = 1 in time t if the person appears in time t+1,
> 0 otherwise (but missing for the last month). I think I've solved this one,
> but am always curious to hear if anyone has any alternate methods that
> might be better. Here is my solution:
> bysort ID (month): gen returned = 1 if month == month[_n+1] - 1
> 2. And this is where I'm stuck. I want to create a dummy variable = 1 in
> time t if the person appears in time t+2, regardless of whether they appear
> in time t+1 or not. I tried:
> bysort ID (month): gen returned_2month = 1 if (month == month[_n+2] - 2)
> But that didn't work because someone who, say, appears in months 1 and 3
> will not have an entry for month[_n+2]. But they should in fact be coded as
> a 1.
*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index