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

Re: st: Reshape problem


From   Rafal Raciborski <rafal.raciborski@emory.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Reshape problem
Date   Sat, 08 Oct 2005 19:02:33 -0400

. list

    +------------------------------------+
    | year   amount1   amount2   amount3 |
    |------------------------------------|
 1. |   90         2         7         9 |
 2. |   91         5         9         2 |
 3. |   92         7         1         8 |
    +------------------------------------+

. reshape long amount, i(year) j(id_amt)
(note: j = 1 2 3)

<snip>

. list

    +------------------------+
    | year   id_amt   amount |
    |------------------------|
 1. |   90        1        2 |
 2. |   90        2        7 |
 3. |   90        3        9 |
 4. |   91        1        5 |
 5. |   91        2        9 |
    |------------------------|
 6. |   91        3        2 |
 7. |   92        1        7 |
 8. |   92        2        1 |
 9. |   92        3        8 |
    +------------------------+

. reshape wide amount, i(id_amt) j(year)
(note: j = 90 91 92)

<snip>

. list

    +-----------------------------------------+
    | id_amt   amount90   amount91   amount92 |
    |-----------------------------------------|
 1. |      1          2          5          7 |
 2. |      2          7          9          1 |
 3. |      3          9          2          8 |
    +-----------------------------------------+


================
Rafal Raciborski
Graduate student
Department of Political Science
Emory University
301 Tarbutton Hall
1555 Dickey Drive
Atlanta, GA 30322
404-378-9826 (home)
rafal.raciborski@emory.edu
http://www.roofoos.net/


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index