Statalist


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

st: -reshape-? -xpose-?


From   Alexander Tsai <[email protected]>
To   [email protected]
Subject   st: -reshape-? -xpose-?
Date   Sat, 24 Nov 2007 23:35:38 -0800

Dear statalisters,

This might be an easy question, but I'm not coming with any good solutions, and a search of the archive didn't yield any promising leads.

I have a dataset of survey responses that looks like this:

ID q1_e1 q1_e2 q2_e1 q2_e2 ... q20_e1 q20_e2
1 1 1 0 1 ... 1 1
2 0 0 1 1 ... 0 1
...
100 1 1 1 1 ... 1 1

There are more variables in the actual data than I show in the above example. (Variables extend from q1_e3, q1_e4, q1_e5 ... to q20_e3, q20_e4, q20_e5.)

I want the dataset to look like this:

ID q e1 e2 e3 e4 e5
1 1 1 1
1 2 0 1
...
1 20 1 1
2 1 0 0
2 2 1 1
...
2 20 0 1
...
100 1 1 1
100 2 1 1
...
100 20 1 1

I've been toying with -reshape- and -xpose- for days, but I've got nothing. Any suggestions?

Much thanks,
Alex
*
* 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