# st: reshape question

 From Caleb Southworth To statalist@hsphsun2.harvard.edu Subject st: reshape question Date Wed, 17 May 2006 17:46:31 -0700 (PDT)

```What does it mean that the values of a certain variable "would be changed"
but are not changed in reshape? Note 4th line in below output. A listing
of two cases before and after reshape follow.

. reshape long _ adj, i(id) j(year)
(note: j = 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955
1956)
_1949:  23 values would be changed; not changed

Data                               wide   ->   long
-----------------------------------------------------------------------------
Number of obs.                      355   ->    4615
Number of variables                  29   ->       8
j variable (13 values)                    ->   year
xij variables:
_1944 _1945 ... _1956   ->   _
-----------------------------------------------------------------------------

. reshape error
(note: j = 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955
1956)
year is unique within id and
all the "reshape xi" variables are constant within year;
there is no error with which "reshape error" can help.

Here's a sample of the original data in wide format:

. list in 97/98 , nol line(60)

+-----------------------------------------------------+
97. |  id |                                 union | _1944 |
| 102 | laundry, cleaning and dy house wokers | 50.00 |
|-----------------------------------------------------|
| _1945  | _1946  | _1947  | _1948  | _1949  | _1950  |
| 50.00  | 56.70  | 60.70  | 61.30  | 67.30  | 72.80  |
|--------+--------+--------+--------+--------+--------|
| _1951  | _1952  | _1953  | _1954  | _1955  | _1956  |
| 72.20  | 71.80  | 74.80  | 73.00  | 72.40  | 93.80  |
|-----------------------------------------------------|
|    . |       . |    . |       . |       . |       . |
|-----------------------------------------------------|
|       . |       .  |       .  |       .  |       .  |
|-----------------------------------------------------|
|           .     |           .     |           .     |
+-----------------------------------------------------+

+-----------------------------------------------------+
98. |  id |                                 union | _1944 |
| 103 |                       leather workers |  2.80 |
|-----------------------------------------------------|
| _1945  | _1946  | _1947  | _1948  | _1949  | _1950  |
|  2.90  |  4.00  |  3.50  |  3.00  |  3.30  |  3.30  |
|--------+--------+--------+--------+--------+--------|
| _1951  | _1952  | _1953  | _1954  | _1955  | _1956  |
|     .  |     .  |     .  |     .  |     .  |     .  |
|-----------------------------------------------------|
|    . |       1 |    0 |       . |       . |       . |
|-----------------------------------------------------|
|       . |       .  |       .  |       .  |       .  |
|-----------------------------------------------------|
|           .     |           .     |           .     |
+-----------------------------------------------------+

And then after the reshape:

. list if id==102|id==103, nol noob str(10)

+-----------------------------------------------------------------+
|  id   year   union              _   taf2   pol_dem   sum3   adj |
|-----------------------------------------------------------------|
| 102   1944   laundry, c..   50.00      .         .      .     . |
| 102   1945   laundry, c..   50.00      .         .      .     . |
| 102   1946   laundry, c..   56.70      .         .      .     . |
| 102   1947   laundry, c..   60.70      .         .      .     . |
| 102   1948   laundry, c..   61.30      .         .      .     . |
|-----------------------------------------------------------------|
| 102   1949   laundry, c..   67.30      .         .      .     . |
| 102   1950   laundry, c..   72.80      .         .      .     . |
| 102   1951   laundry, c..   72.20      .         .      .     . |
| 102   1952   laundry, c..   71.80      .         .      .     . |
| 102   1953   laundry, c..   74.80      .         .      .     . |
|-----------------------------------------------------------------|
| 102   1954   laundry, c..   73.00      .         .      .     . |
| 102   1955   laundry, c..   72.40      .         .      .     . |
| 102   1956   laundry, c..   93.80      .         .      .     . |
| 103   1944   leather wo..    2.80      .         1      0     . |
| 103   1945   leather wo..    2.90      .         1      0     . |
|-----------------------------------------------------------------|
| 103   1946   leather wo..    4.00      .         1      0     . |
| 103   1947   leather wo..    3.50      .         1      0     . |
| 103   1948   leather wo..    3.00      .         1      0     . |
| 103   1949   leather wo..    3.30      .         1      0     . |
| 103   1950   leather wo..    3.30      .         1      0     . |
|-----------------------------------------------------------------|
| 103   1951   leather wo..       .      .         1      0     . |
| 103   1952   leather wo..       .      .         1      0     . |
| 103   1953   leather wo..       .      .         1      0     . |
| 103   1954   leather wo..       .      .         1      0     . |
| 103   1955   leather wo..       .      .         1      0     . |
|-----------------------------------------------------------------|
| 103   1956   leather wo..       .      .         1      0     . |
+-----------------------------------------------------------------+

Caleb
caleb@uoregon.edu
University of Oregon Sociology
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```