Dear All, I am working on a dataset and am stuck at one point where I need to create a dummy variable. I have a set of information which includes the following information: Firm Year INDEX A 2001 0 A 2002 1 A 2003 1 A 2004 1 A 2005 1 A 2006 1 A 2007 1 A 2008 1 A 2009 0 B 2001 0 B 2002 0 B 2003 1 B 2004 1 B 2005 1 B 2006 1 B 2007 0 I want to create five dummy variables: ADD, OUT, ONGOING, ONGOING1, ONGOING2. ADD is 1 for the first year when INDEX is 1 and 0 otherwise. OUT is 1 for the year following the last year of INDEX =1. ONGOING is 1 for years when INDEX is 1 excepte for the first year. ONGOING1 is 1 for the 2nd and the 3rd year of INDEX =1. ONGOING2 is 1 for the any year after the third year of INDEX =1. In other words, I am trying to get the output to look like this: Firm Year INDEX ADD OUT ONGOING ONGOING1 ONGOING2 A 2001 0 0 0 0 0 0 A 2002 1 1 0 0 0 0 A 2003 1 0 0 1 1 0 A 2004 1 0 0 1 1 0 A 2005 1 0 0 1 0 1 A 2006 1 0 0 1 0 1 A 2007 1 0 0 1 0 1 A 2008 1 0 0 1 0 1 A 2009 0 0 1 0 0 0 B 2001 0 0 0 0 0 0 B 2002 0 0 0 0 0 0 B 2003 1 1 0 0 0 0 B 2004 1 0 0 1 1 0 B 2005 1 0 0 1 1 0 B 2006 1 0 0 1 0 1 B 2007 0 Although I did have some success in creating the ADD, OUT, and ONGOING, I am not sure how to construct ONGOING1 and ONGOING2. I would appreciate if someone would help me with them. Thank you.
... View more