Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "Katie and Matt O'Varanese" <ovaranese@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | st: Collapsing and Reshaping |
Date | Mon, 29 Nov 2010 22:53:17 -0500 |
I am trying to reshape some data long... right now the data looks like this for example: id_code year math06 math07 math08 eng06 eng07 eng08 112 2006 112 2007 112 . 112 . 113 2006 113 2007 113 . 113 2008 114 . 114 2007 114 2008 When I try: reshape long [vars@x], i(id_code) j(year) i get an error message "i=id_code does not uniquely identify the observations; there are multiple observations with the same value of id_code." Do I need to collapse first? If so, when I try to collapse by (id_code year), I get an error message saying that the year variable has missing values. Do I need to change the missing values to a numeric dummy just to complete the command? or is there a better way to do this? Ultimate goal: I want to have unique id_code and then a year variable with each of the three years represented (06, 07, 08). Help please! Thanks as always!! Kate * * 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/