Arnold,
Try -help reshape-
However, my short advice is this: Assume you have the following data (note that
you can have missing values and unequal number of observations per
participant):
. list participant values
+-------------------+
| partic~t values |
|-------------------|
1. | 1 2 |
2. | 1 3 |
3. | 1 . |
4. | 1 6 |
5. | 1 7 |
|-------------------|
6. | 1 12 |
7. | 2 2 |
8. | 2 6 |
9. | 2 7 |
10. | 2 8 |
|-------------------|
11. | 2 10 |
12. | 3 0 |
13. | 3 3 |
14. | 3 4 |
15. | 3 5 |
|-------------------|
16. | 3 16 |
17. | 3 21 |
+-------------------+
First, create a variable indicator (if you do not have any):
. list
+----------------------------+
| partic~t values var_id |
|----------------------------|
1. | 1 2 1 |
2. | 1 3 2 |
3. | 1 . 3 |
4. | 1 6 4 |
5. | 1 7 5 |
|----------------------------|
6. | 1 12 6 |
7. | 2 2 1 |
8. | 2 6 2 |
9. | 2 7 3 |
10. | 2 8 4 |
|----------------------------|
11. | 2 10 5 |
12. | 3 0 1 |
13. | 3 3 2 |
14. | 3 4 3 |
15. | 3 5 4 |
|----------------------------|
16. | 3 16 5 |
17. | 3 21 6 |
+----------------------------+
Finally, reshape into wide format:
. reshape wide values, i(participant) j(var_id)
/* output omitted */
. list
+----------------------------------------------------------------------+
| partic~t values1 values2 values3 values4 values5 values6 |
|----------------------------------------------------------------------|
1. | 1 2 3 . 6 7 12 |
2. | 2 2 6 7 8 10 . |
3. | 3 0 3 4 5 16 21 |
+----------------------------------------------------------------------+
Hope this helps,
rafal
================
Rafal Raciborski
Graduate student
Department of Political Science
Emory University
301 Tarbutton Hall
1555 Dickey Drive
Atlanta, GA 30322
404-378-9826 (home)
[email protected] (e-mail)
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/