Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

[no subject]



. l

     +------------------------------------------------------+
     | id   sch1   sch2   start1     end1   start2     end2 |
     |------------------------------------------------------|
  1. |  1     73      .   199308   200000        .        . |
  2. |  2     46      .   199307   199506        .        . |
  3. |  3     12     16   199308   199505   199508   199606 |
  4. |  4     94     58   199408   199412   199501   199606 |
  5. |  5     24      .   199608   199706        .        . |
     |------------------------------------------------------|
  6. |  6     84     43   199308   199605   199608   199611 |
  7. |  7     16      .   199508   200000        .        . |
  8. |  8     59     87   199309   199406   199609   200000 |
     +------------------------------------------------------+

. reshape long sch start end , i(id) 
(note: j = 1 2)

Data                               wide   ->   long
-----------------------------------------------------------------------------
Number of obs.                        8   ->      16
Number of variables                   7   ->       5
j variable (2 values)                     ->   _j
xij variables:
                              sch1 sch2   ->   sch
                          start1 start2   ->   start
                              end1 end2   ->   end
-----------------------------------------------------------------------------

. l

     +---------------------------------+
     | id   _j   sch    start      end |
     |---------------------------------|
  1. |  1    1    73   199308   200000 |
  2. |  1    2     .        .        . |
  3. |  2    1    46   199307   199506 |
  4. |  2    2     .        .        . |
  5. |  3    1    12   199308   199505 |
     |---------------------------------|
  6. |  3    2    16   199508   199606 |
  7. |  4    1    94   199408   199412 |
  8. |  4    2    58   199501   199606 |
  9. |  5    1    24   199608   199706 |
 10. |  5    2     .        .        . |
     |---------------------------------|
 11. |  6    1    84   199308   199605 |
 12. |  6    2    43   199608   199611 |
 13. |  7    1    16   199508   200000 |
 14. |  7    2     .        .        . |
 15. |  8    1    59   199309   199406 |
     |---------------------------------|
 16. |  8    2    87   199609   200000 |
     +---------------------------------+

. drop if mi(sch) 




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