Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "Martin Weiss" <martin.weiss1@gmx.de> |
To | <statalist@hsphsun2.harvard.edu> |
Subject | st: AW: constructing a panel |
Date | Tue, 22 Jun 2010 18:06:29 +0200 |
<> So this is a first shot: ************* clear* input byte id int date byte(x y z) 1 2001 1 1 15 1 2003 2 1 15 2 2000 1 1 15 3 2001 1 2 17 3 2003 3 2 17 4 2000 1 1 17 4 2003 2 1 17 end fillin id date gen byte transact =!_fillin drop _fillin list, noo sepby(id) ************* There are no observations for 2002/2004 initially, so -fillin- cannot add them to all ids. Is that also true for your real data? HTH Martin -----Ursprüngliche Nachricht----- Von: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von DC Gesendet: Dienstag, 22. Juni 2010 17:52 An: Statalist Statalist Betreff: st: constructing a panel Hi, I have a problem someone with more expertise may be able to help me with. I have data in transactions form on housing transactions that I want to transform into a balanced panel running over several years Specifically, I have data of the following form with x denoting a time- varying house characteristic; y denotes a permanent house characteristic, and z denotes a permanent neighborhood characteristic: id date x y z 1 2001 1 1 15 1 2003 2 1 15 2 2000 1 1 15 3 2001 1 2 17 3 2003 3 2 17 4 2000 1 1 17 4 2003 2 1 17 The key feature is that I only observe the house when it is transacted so the years when it did not transact will have a transaction indicator 0 like this: id date transact x y z 1 2000 0 . 1 15 1 2001 1 1 1 15 1 2002 0 1 1 15 1 2003 1 2 1 15 1 2004 0 2 1 15 2 2000 1 1 1 15 2 2001 0 1 1 15 2 2002 0 1 1 15 2 2003 0 1 1 15 2 2004 0 1 1 15 3 2000 0 . 1 17 3 2001 1 1 1 17 3 2002 0 1 1 17 3 2003 1 3 1 17 3 2004 0 3 1 17 4 2000 1 1 1 17 4 2001 0 1 1 17 4 2002 0 1 1 17 4 2003 1 2 1 17 4 2004 0 2 1 17 I'm pretty sure I should be using expand but not sure how to get this right. Thanks in advance for any help you can give me. Regards, Marcus -- Marcus Casey, Ph.D. Duke University * * 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/