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: Collapsing and Reshaping

From   "Katie and Matt O'Varanese" <>
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!!

*   For searches and help try:

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