Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: reshape question


From   Caleb Southworth <[email protected]>
To   [email protected]
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
(note: adj1955 not found)
(note: adj1956 not found)

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

. 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  |
     |-----------------------------------------------------|
     | taf2 | pol_dem | sum3 | adj1944 | adj1945 | adj1946 |
     |    . |       . |    . |       . |       . |       . |
     |-----------------------------------------------------|
     | adj1947 | adj1948  | adj1949  | adj1950  | adj1951  |
     |       . |       .  |       .  |       .  |       .  |
     |-----------------------------------------------------|
     |     adj1952     |     adj1953     |     adj1954     |
     |           .     |           .     |           .     |
     +-----------------------------------------------------+

     +-----------------------------------------------------+
 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  |
     |     .  |     .  |     .  |     .  |     .  |     .  |
     |-----------------------------------------------------|
     | taf2 | pol_dem | sum3 | adj1944 | adj1945 | adj1946 |
     |    . |       1 |    0 |       . |       . |       . |
     |-----------------------------------------------------|
     | adj1947 | adj1948  | adj1949  | adj1950  | adj1951  |
     |       . |       .  |       .  |       .  |       .  |
     |-----------------------------------------------------|
     |     adj1952     |     adj1953     |     adj1954     |
     |           .     |           .     |           .     |
     +-----------------------------------------------------+

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
[email protected]
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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index